필터 지우기
필터 지우기

problem in storing data in cell

조회 수: 2 (최근 30일)
mira
mira 2015년 4월 19일
댓글: Image Analyst 2015년 4월 20일
I have a loop and the result will be different in the loop. I want to store the result in a cell. However, only the last part will display in the cell. here is the result when I run the coding.
new =
[0x512 double]
new =
[]
[143x512 double]
new =
[]
[]
[146x512 double]
what is the problem?

채택된 답변

Image Analyst
Image Analyst 2015년 4월 20일
Looks like you're initializing new inside a loop, like this
for k = 1 : 3
new = cell(3,1);
new{k} = someArray;
end
You need to take the initialization step out of the loop and put it before the loop, like this:
new = cell(3,1);
for k = 1 : 3
new{k} = someArray;
end
  댓글 수: 2
mira
mira 2015년 4월 20일
편집: mira 2015년 4월 20일
Thank you..it's work! My I ask another question? I am doing push button GUI but I want to call the other pushbutton using if else. but it doesn't work. every push button will have different result and i only want to display the result in one static text.
Image Analyst
Image Analyst 2015년 4월 20일
There is not enough information to answer that. Perhaps the FAQ will help: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by