How to make a structure with numerous(>200) fields with loop?
이전 댓글 표시
Hello everyone,
I want to make a structure with fields for each patient, then the cell type(5 by 5) EEG data would be allocated to the fields.
I simply know this way,
S = struct('Pt1',data1,'Pt2',data2,....blablabla)
this makes super long awful code...
I've tried loop like this way but it didn't worked
for i = 1:n
S = struct(strcat('Pt_',num2str(i)),Data(i))
end
please help me :)
댓글 수: 2
You could use CELL2STRUCT:
for which NUM2CELL might als be useful. Or NUM2CELL and then a comma-separated list with STRUCT:
Most likely a loop is not required.
JAYYOUNG
2023년 7월 4일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!