Using loop to read column from excel sheet
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello, I am working on data processing.
I have an excel sheet that contains hundreds of subjects.
My job is to analyse the data from each subjects and compare them. So far, I have finish import and analyse first several subjects.
Since each column is a subject, I use "xlsread('mini_project_normalRR.mat.xlsx',1,'A:A');" to read each of them.
I want to ask if there is a loop function that could help me read through each column and perform the exact analysis for the rest of the data? And record the analyse into a separate table?
0 Commenti
Risposta accettata
Raunak Gupta
il 2 Mag 2020
Hi,
You can use readmatrix instead of xlsread. readmatrix will return a matrix from the ‘.xlsx’ file that will contain column of each subject as required. From that you can iterate into the columns and do the required processing on each column. Following code can help you get started.
data = readmatrix('mini_project_normalRR.mat.xlsx');
numColumn = size(data,2);
result = zeros(size(data));
for idx = 1:numColumn
subject = data(:,idx);
% Your processing code on each column goes here
% Output of analysis is let say same length vector as of subject
% Assign it a matrix with corresponding coloumn number
% Lets say analysisResult is the result of one column.
result(:,idx) = analysisResult;
end
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!