필터 지우기
필터 지우기

Reference to non-existent field 'Gait_0002'.

조회 수: 1 (최근 30일)
Muhammad Hadyan Utoro
Muhammad Hadyan Utoro 2022년 1월 7일
댓글: Muhammad Hadyan Utoro 2022년 1월 8일
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

채택된 답변

Cris LaPierre
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)))
  댓글 수: 1
Muhammad Hadyan Utoro
Muhammad Hadyan Utoro 2022년 1월 8일
Thank you, Sir! I made it. Appreciate your help

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by