Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

in gui matlab?

2 visualizzazioni (ultimi 30 giorni)
hadi mostafavi amjad
hadi mostafavi amjad il 21 Lug 2018
Chiuso: MATLAB Answer Bot il 20 Ago 2021
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?!

Risposte (1)

Image Analyst
Image Analyst il 21 Lug 2018
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';

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by