|
Hi,
I use
[num,txt,raw] = xlsread('Mysheet.xlsx')
to import some data from Excel, having both strings and numbers.
What I need to do next is store columns of "raw" as a separate cell arrays.
[num,txt,raw] = xlsread('Mysheet.xlsx')
A = raw(:,1);
B = raw(:,2);
C = raw(:,3:5);
D = raw(:,6);
Notice Cell array C above: I need this to have columns 3-5 of "raw".
Strange problem is:
When I write the command C = raw(:,3:5); in the Matlab command window, it works fine. I get a 3-column cell array, each column having length equal to length(raw).
However, when I have the whole code above in an M file, and run it, the array C is created as a ONE ROW vector having (3*length(raw)) elements in it!
It seems very strange that the command works correctly when I use it in the Command window, but THE SAME COMMAND works incorrectly when I use it in an M file.
Has anyone seen something like this before?
Thanks a lot in advance,
Alaa
|