Using a for loop to access the correct fields in a struct
    조회 수: 1 (최근 30일)
  
       이전 댓글 표시
    
Hello Community,
I have a little query here (hopefully!) I am simply trying to ask the for loop to run through a struct ('Ss.') with various fields named pl1, pl2, pl3 etc. and work out the standard deviation for each field and assign to a new field named Ss.Sdpl for the same number of fields - 'i'.
for i = 1:N
Ss.Sdpl(i) = std(Ss.pl(i));
end
Unfortunately it returns the error: Reference to non-existent field 'pl', which of course I understand, but how should I write the syntax to run through Ss.pl 1, Ss.pl 2, Ss.pl 3 etc?
Any help would be much appreciated...
10B.
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
			
	제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
