Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Why am I getting this error? "Argument to dynamic structure reference must evaluate to a valid field name."
조회 수: 1 (최근 30일)
이전 댓글 표시
I'm simply trying to print a string name for a file I'm importing, and I get this error when I use fprintf: "Argument to dynamic structure reference must evaluate to a valid field name." Here's my code:
%% Import the data files
dr = dir('C:\Users\d-r\Box Sync\DATA\MAIN\training\*psv');
data=[];
for k=1:numel(dr)
data{k,1}.encounter_num = k;
data{k,1}.labs = importData([dr(k).folder filesep dr(k).name]);
data{k,1}.vitals = importData([dr(k).folder filesep dr(k).name]);
fprintf('Importing %s\n',dr.(k).name)
end
Please help, thx!
댓글 수: 0
답변 (1개)
Walter Roberson
2019년 9월 12일
In the fprintf you have dr.(k).name when you should have had dr(k).name
댓글 수: 1
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!