Filtering Data with Matlab in FITS Format

  • Thread starter Thread starter TFM
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 3K views
TFM
Messages
1,016
Reaction score
0

Homework Statement



I have got a table of data, and want to use Matlab to sort this data and filter out some variables. The data was orginally in a FITS format.

Homework Equations



N/A

The Attempt at a Solution



Sorry if this is the wrong thread.

I have tried two different versions of code:

hd = (data{12} < rsd);
data_filtered = filter(hd,data,:);

and

idx = (rs < rsd);
data_filtered = data(:,idx);

I need it to filter out all data with a Redshift less then a specified number

Any ideas or thoughts would be really appreciated

Thanks,

TFM
 
Physics news on Phys.org
Okay, I have found that the data seems to be in a 1x55 table which is the reason I am having trouble filtering it - I get a error message about matrix dimensions.

Any ideas the best way to sort this kind of table?

Many thanks,

TFM
 
Okay I was told Matlab had put my Data in a weird way so I have now entered the data into a Structure. Does the Filter command still work for Structures, as using the code:

idx = (datastruct.Redshift < rsd);
data_filtered = datastruct(idx)

Gives me a Matrix Error:

? Index exceeds matrix dimensions.

Error in ==> DensityFunct3 at 12
data_filtered = datastruct(idx)


Any ideas would be greatly appreciated

Many Thanks

TFM
 
I think the problem is in the index of datastruct, as it is showing. May be the length of data_filtered is not the same as datastruct. It is very common problem occurs in MATLAB. For Example : if H=[1:5]; and then Y=[1:7]; and if you do H=Y(15); then it occurs. Hope it is helpful