loading excel cell in matlab
Ältere Kommentare anzeigen
Hey
I am facing the 'Index exceeds matrix dimensions' Error while using xlsread
[WL_time,dummy1,dummy2]=xlsread(WL_data(nn).name,1,'B8')
Its in a for loop and nn is the counter, I define 'WL_data' as
WL_data=dir('*.xlsx')
Index exceeds matrix dimensions.
Error in Unsteady_fm50hz_150sec (line 51)
[WL_time,dummy1,dummy2]=xlsread(WL_data(nn).name,1,'B8');
I would be glad if you help me
9 Kommentare
Alex Mcaulley
am 18 Jun. 2019
How are you implementing the nn loop?
for nn = 1:numel(WL_data) %??
Try debugging your code putting a breakpoint inside the loop to see what is happening.
Alex Mcaulley
am 18 Jun. 2019
How do you count the number of excel files? How you define N1?
mehra
am 18 Jun. 2019
Alex Mcaulley
am 18 Jun. 2019
This should work. Try debugging your code to see why it is happening. Without the full code is difficult to guess it.
Alex Mcaulley
am 18 Jun. 2019
At least the code inside the loop is needed to go further. It seems to be an error in
WL_data(nn).name
A simple check is to see if N1 is the total number of xlsx files in your folder.
Walter Roberson
am 18 Jun. 2019
Bearbeitet: Walter Roberson
am 18 Jun. 2019
Your file loaded via load(vel_data(nn).name) contains a variable named nn that is overriding the for nn loop value
You should avoid using load without an output variable:
datastruct = load(vel_data(nn).name);
Data = datastruct.Data;
mehra
am 18 Jun. 2019
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!