Madlab iseqaul edit field

1 view (last 30 days)
NoHandInMatlab
NoHandInMatlab on 2 Nov 2021
Commented: Rik on 3 Nov 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.

Answers (1)

Benjamin
Benjamin on 2 Nov 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 Comments
Rik
Rik on 3 Nov 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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!