Filtering Data with Matlab in FITS Format

  • Thread starter Thread starter TFM
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion focuses on filtering data in MATLAB from a FITS format table, specifically to exclude entries with a Redshift less than a specified value. The user initially encounters issues with matrix dimensions while attempting to filter the data using various indexing methods. After converting the data into a structure, they continue to face errors related to matrix indexing. Suggestions highlight that the problem may stem from mismatched dimensions between the filtered data and the original structure. The conversation emphasizes the importance of ensuring compatible dimensions when filtering data in MATLAB.
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
 
Thread 'Have I solved this structural engineering equation correctly?'
Hi all, I have a structural engineering book from 1979. I am trying to follow it as best as I can. I have come to a formula that calculates the rotations in radians at the rigid joint that requires an iterative procedure. This equation comes in the form of: $$ x_i = \frac {Q_ih_i + Q_{i+1}h_{i+1}}{4K} + \frac {C}{K}x_{i-1} + \frac {C}{K}x_{i+1} $$ Where: ## Q ## is the horizontal storey shear ## h ## is the storey height ## K = (6G_i + C_i + C_{i+1}) ## ## G = \frac {I_g}{h} ## ## C...

Similar threads

Replies
2
Views
4K
Replies
1
Views
6K
Replies
8
Views
2K
Replies
6
Views
5K
Replies
2
Views
9K
Back
Top