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