Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

in gui matlab?

조회 수: 1 (최근 30일)
hadi mostafavi amjad
hadi mostafavi amjad 2018년 7월 21일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi. I have a value that I want to calculate, and another value must be calculated from this value (the second one calculated from the first value). But the problem is I work by “gui” and the first values are calculated from 2 edit boxes, and it must saved for the next calculation! But when I want to calculate the second one, because I should turn that edit boxes to zero, the first calculation change to zero and all of the calculation going to “NaN”!!!!!!
How should I save the values for my calculations?! Without changing by set the edit boxes values?!

답변 (1개)

Image Analyst
Image Analyst 2018년 7월 21일
Use them BEFORE you set them to zero of course. For example
value1 = str2double(handles.edit1.String);
value2 = str2double(handles.edit2.String);
firstValue = 2 * value1 + 5 * value2; % or whatever your formula is.
% Now use this first value to compute a "second" value.
secondValue = 9 * firstValue; % or whatever your formula is.
% Now set edit box strings (that were used in the
% calculation of the firstValue) equal to zero.
handles.edit1.String = '0';
handles.edit2.String = '0';

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by