フィルターのクリア

Using loop to read column from excel sheet

17 ビュー (過去 30 日間)
An Van
An Van 2020 年 4 月 27 日
回答済み: Raunak Gupta 2020 年 5 月 2 日
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?

採用された回答

Raunak Gupta
Raunak Gupta 2020 年 5 月 2 日
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 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by