loading excel cell in matlab
显示 更早的评论
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 个评论
Alex Mcaulley
2019-6-18
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
2019-6-18
How do you count the number of excel files? How you define N1?
mehra
2019-6-18
Alex Mcaulley
2019-6-18
This should work. Try debugging your code to see why it is happening. Without the full code is difficult to guess it.
Alex Mcaulley
2019-6-18
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
2019-6-18
编辑:Walter Roberson
2019-6-18
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
2019-6-18
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!