Reference to non-existent field 'Gait_0002'.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello everyone,
I had a trouble sorting out data from a cell into a structure. So, I'd like to include the data from previous cell into a new structure, but this keeps popping out:
Reference to non-existent field 'Gait_0002'.
Error in ImportingData (line 21)
Data.EMG.(gait{j}) = Data.Gait{i}.(gait{j}).Analog.Data(3:12,:)';
Here are my codes:
% Defining Files
filenames = {'Bridge_2_0001';'Lunge_R_0001';'Squat_2_0001';'Lunge_L_0001'};
filestem = 'Gait_000';
gait = ["Gait_0001" "Gait_0002" "Gait_0003" "Gait_0004" "Gait_0004" "Gait_0005" "Gait_0006" "Gait_0007"];
muscles = ["RF_L", "RF_R" "ST_L" "ST_R" "GA_L" "GA_R" "TA_L" "TA_R" "VL_L" "VL_R"];
% Load Files
for i = 1:7
for j = 1:numel(filenames)
for m = 1:10
Data.Gait{i} = load(strcat(filepath,filestem,num2str(i)));
Data.(char(filenames{j})) = load(strcat(filepath,filenames{j}));
Data.EMG.(gait{j}) = Data.Gait{i}.(gait{j}).Analog.Data(3:12,:)';
end
end
end
I really appreciate your help.
Thanks
댓글 수: 0
채택된 답변
Cris LaPierre
2022년 1월 7일
It would appear that Data.Gait{i} does not containt a fieldname Gait_0002.
You are using your loop counter i, so it is hard to say which file does not have this fieldname, but when you get the error, check the value of i, and then run the following to determine which file to inspect.
load(strcat(filepath,filestem,num2str(i)))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!