Borrar filtros
Borrar filtros

How could I show a text if it's gave in number and I want to show it as a text?

1 visualización (últimos 30 días)
I'm making a GUI; the user input a values and the main program output a number given those inputs but I don't to show the output-number, instead I want to show it as some linguistic. here is the code:
%%Those takes the inputs from a textbox and converts to double
Risk1=str2double(get(handles.Riesgo1,'String'));
Risk2=str2double(get(handles.Riesgo2,'String'));
Risk3=str2double(get(handles.Riesgo3,'String'));
Risk4=str2double(get(handles.Riesgo4,'String'));
Risk5=str2double(get(handles.Riesgo5,'String'));
%%This resolves an evaluation in the main program and hold it in 'momentocorrecto'
momentocorrecto=evalfis([Risk1 Risk2 Risk3 Risk4 Risk5],readfis('TG2'));
%%this put the number 'momentocorrecto' and sets in other textbox
set(handles.MomentoCorrecto,'String',momentocorrecto);
my solution was using if-elsif:
if 7<=momentocorrecto<=9
set(handles.MomentoCorrecto,'String','Elevado');
elseif 5<=momentocorrecto<7
set(handles.MomentoCorrecto,'String','Alto');
elseif 3<=momentocorrecto<5
set(handles.MomentoCorrecto,'String','Medio');
elseif 0<=momentocorrecto<3
set(handles.MomentoCorrecto,'String','Bajo');
else
set(handles.MomentoCorrecto,'String','');
end
At first it gaves me 'Elevado', but when I switch the inputs it keeps showing 'Elevado' and that's a mistake. I tried also with switch-case, doesn't work!! Thanks for your help

Respuestas (1)

Muhammad Usman Saleem
Muhammad Usman Saleem el 18 de Jun. de 2016
use
str(value)
to make string of no

Categorías

Más información sobre Fuzzy Logic Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by