loading excel cell in matlab
Afficher commentaires plus anciens
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 commentaires
Alex Mcaulley
le 18 Juin 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
le 18 Juin 2019
How do you count the number of excel files? How you define N1?
mehra
le 18 Juin 2019
Alex Mcaulley
le 18 Juin 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
le 18 Juin 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
le 18 Juin 2019
Modifié(e) : Walter Roberson
le 18 Juin 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
le 18 Juin 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import from MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!