Skipping steps while loading data? Debugging tool used
1 view (last 30 days)
Show older comments
Script does not execute the steps after for i loop? What could be the fault? Thanks!
startpath ='E:\MATLAB\1EXAMENOPDRACHT';
addpath([startpath,'\Assignment_V2']);
Datapath = [startpath '/Data'];
for i = [3 5 7 9 11 13 14 15 16 17]
dataFolder = [Datapath '/TD' num2str(i)];
filePattern = fullfile(dataFolder, '**/EMG/HR*.mot'); %naam van de map een bestandsnaam geven
pathwayEMG_HR = dir(filePattern);
for k = 1:length(pathwayEMG_HR)
EMGHRmaartendata = importdata([dataFolder '/EMG/HR_' num2str(k) '_emg.mot']); % om matlab file van subject te loaden
end
end
0 Comments
Answers (2)
Cris LaPierre
on 15 Dec 2020
Is it skipping it or just not giving you the expected result? Have you checked that the path and file name for your importdata code is correct?
Are there any error messages? If so, please share the entire error message (all the red text).
If you go through the trouble of creating pathwayEMG_HR, why not use it to import your data?
EMGHRmaartendata = importdata(fullfile(pathwayEMG_HR(k).folder,pathwayEMG_HR(k).name));
Note that you are overwriting EMGHRmaartendata every time. You probably want to come up with some strategy to keep all of it. For an example, see this video.
9 Comments
Cris LaPierre
on 16 Dec 2020
The issue is with the "data.data()" part. You are adding an extra field name that doesn't exist.
EventMRdata = rand(4,5);
AEMGstructMR(1,4).data = EventMRdata;
AEMGstructMR(1,4).data(:,1)
AEMGstructMR(1,4).data.data(:,1)
Sounds like this is for a class. Do you have an instructor or TA who could look at what you are doing? They'll have the proper context to answer the questions you are asking.
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!