GUI character checking edit text box

1 visualizzazione (ultimi 30 giorni)
Blaise Konzel
Blaise Konzel il 4 Giu 2019
When I use the get function to get a value from my edit text box I use get(hfig_home.txt_unit_weight, 'string') where hfig.home = handles and txt_unit_weight is the edit text box, Im assuming it stores it as a string so whether its a number or an interger it is stored as a character and I later use str2double to get int value. I am also initalizing all textboxes in the GUI of value NaN to value 0, using a check function, to complete calculations even if a value was not entered in a text box.I want to know how I can check to see what the user entered and if its a character or word to return an error message. I thought about checking before I use str2double but havent been able to figure out how to check get function variable, something like: weight = str2double(check(get(hfig_home.txt_unit_weight, 'string'))); where check is
if isnan(x) == 0
value = x;
elseif isnan(x) ~= 0
value = 0;
end
I want to deploy something in this check function to see what datatype the user entered.

Risposte (0)

Categorie

Scopri di più su Scope Variables and Generate Names in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by