setappdata and getappdata for multiple variables
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi,
I am trying to write a code like
function function1=givenfunction(variable)
for i=1:length(variable)
setappdata (0,'data_(i)',variable(i))
end
end
The '(i)' after 'data_' puts a number stored in 'i'. In another function, I would like to get the data like
function function2=anotherfunction
for i=1:length(variable)
m(i)=getappdata (0,'data_(i)')
end
end
How should I do it? Please help me.
댓글 수: 0
채택된 답변
Walter Roberson
2017년 7월 21일
function function1=givenfunction(variable)
for i=1:length(variable)
setappdata(0, sprintf('data_%d', i), variable(i))
end
end
This would not be recommended. You would typically be much more efficient to just store the entire vector and retrieve it all and pull out the parts you want.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Support Package for USB Webcams에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!