Madlab iseqaul edit field

2 visualizaciones (últimos 30 días)
NoHandInMatlab
NoHandInMatlab el 2 de Nov. de 2021
Comentada: Rik el 3 de Nov. de 2021
Hallo,
ich versuche mit if isequal etwas in app designer zu machen. Und zwar: ich will eine Tabelle Plotten aber wenn in einem Edit field nichts steht soll eine msgbox kommen und sagen dass ich da was reinschreibe und ansonsten geht der plot nicht.
Code:
global t b titlename xaxis yaxis;
title(titlename)
xlabel(xaxis)
ylabel(yaxis)
if isequal(xaxis,0)
msgbox('sdhuf')
elseif isequal(yaxis,0)
msgbox('sdgf')
elseif isequal(titlename,0)
msgbox(' adjfasjn')
else
O=t(:,1:b)
plot(O);
end
Hello,
I am trying to do something in app designer with if isequal. Namely: I want to plot a table but if there is nothing in an edit field a msgbox should come and say that I write something in there and otherwise the plot doesn't work.

Respuestas (1)

Voss
Voss el 2 de Nov. de 2021
I assume the global variable xaxis is a character vector, since it is being used in xlabel like one. If it is, then isequal(xaxis,0) will return true only if xaxis is a single character with ASCII value 0.
From your description, it sounds like you actually want to check isempty(xaxis), etc., rather than comparing to 0.
  2 comentarios
NoHandInMatlab
NoHandInMatlab el 3 de Nov. de 2021
thx its works big thanks
but once i close my user interface after plotting and then restart it, it remembers the old plot and if i don't enter anything it plots the plot from the attempt before.
how can i fix that?
Rik
Rik el 3 de Nov. de 2021
I'm guessing most of your problems are due to the use of globals and other non-standard design choices. There are better ways to share data between callbacks.
For general advice and examples for how to create a GUI, have look at this thread.

Iniciar sesión para comentar.

Categorías

Más información sobre Automotive 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