Multiplying structure array with a scaler
조회 수: 5 (최근 30일)
이전 댓글 표시
I have Data.mat file that is a 1x365 structure array and i would like to multiply all the values of the 4th column by 2 and store them in to a variable.
채택된 답변
Matt J
2021년 3월 22일
If you mean you want to multiply all the fields by 2,
s0.a=1;s0.b=2;s0.c=3 %example struct
s=structfun(@(f)2*f, s0,'uni',0)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!