loading excel cell in matlab
Mostrar comentarios más antiguos
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 comentarios
Alex Mcaulley
el 18 de Jun. de 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
el 18 de Jun. de 2019
How do you count the number of excel files? How you define N1?
mehra
el 18 de Jun. de 2019
Alex Mcaulley
el 18 de Jun. de 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
el 18 de Jun. de 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
el 18 de Jun. de 2019
Editada: Walter Roberson
el 18 de Jun. de 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
el 18 de Jun. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!