Changing Structure field value from a function
이전 댓글 표시
Greetings all,
I have a question regarding the Structure field value. I'm trying to change a field of my structure that is already in the workspace. as follows: mys(1).id = {100};
I can do that from the command line and the value changes, but that is not happening from inside the function. Any idea why is that ?
댓글 수: 2
KSSV
2016년 11월 9일
Are you sending the data which in work-space to the function? Show us your code.
MoHAJNEN komo olkm
2016년 11월 9일
편집: MoHAJNEN komo olkm
2016년 11월 9일
채택된 답변
추가 답변 (1개)
Guillaume
2016년 11월 9일
0 개 추천
Matlab is pass-by-value. functions always receive the copy of the variable. Any change you make to variables are only local to the function unless the function also returns the variable as an output and the caller assigns that output back to the original variable.
카테고리
도움말 센터 및 File Exchange에서 Other Formats에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!