Reading and processing multiple rows from Excel
4 views (last 30 days)
Show older comments
I have two spreadsheets with about 9000 rows of data each. I'm trying to take the data from the same row in each spreadsheet and process it like so:
A = xlsread('Book1.xlsx', 'A1:I1')
B = xlsread('Book2.xlsx', 'A1:I1')
pval=ranksum(A,B)
How can I make a loop that increases the row number each time it runs? Or is there a better method for such a large sheet?
Answers (1)
oliver
on 26 Sep 2018
You do a simple loop like so:
for i=1:n %n should contain the number of lines you want to run through
ln=num2str(i); % string of current line
A=xlsread('Book1.xlsx', ['A',ln,':I',ln])
B=xlsread('Book2.xlsx', ['A',ln,':I',ln])
pval=ranksum(A,B)
end
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!