reading data by column

17 views (last 30 days)
Michael Angeles
Michael Angeles on 1 Feb 2022
Commented: Michael Angeles on 1 Feb 2022
Hello, I have data that is n x m (rows,column). I want to read each column and perform some analysis on the data prior to moving on to another column and performing the same analysis.
Is there a method on how to perform this reiterative process? Thanks,

Accepted Answer

Voss on 1 Feb 2022
If you have an n-by-m matrix you can do as follows:
n = 100;
m = 50;
data = randn(n,m);
results = cell(1,m);
for jj = 1:m
results{jj} = perform_analysis(data(:,jj));
Where perform_analysis() is a function that performs the analysis you want to do on each column and returns something.
If instead your data is in a file, it may or may not be convenient to read it by column, depending on the file format.
Michael Angeles
Michael Angeles on 1 Feb 2022
Thank you for your help, I was able to get the program running.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!