필터 지우기
필터 지우기

Help needed in creating dynamic field names using struct in matrix form.

조회 수: 2 (최근 30일)
Rick
Rick 2012년 10월 24일
편집: Stephen23 2016년 1월 12일
Hi,
I am currently using this code:
rename = sprintf('I%inewEp', i);
newData.(rename) = myData.Ep;
newData.(rename(:,1)) = myData.Ep(:,1) - X; %Error starts from here
newData.(rename(:,2)) = myData.Ep(:,2) - Y;
I keep getting errors when the code performs the subtractions.
Any suggestions would be greatly appreciated. Thank you.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 10월 24일
newData.(rename) = bsxfun(@minus,myData.Ep,[X Y]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by