Unable to change label text via code

9 Ansichten (letzte 30 Tage)
Basem Nabil
Basem Nabil am 8 Mai 2019
Hello,
I have created several labels using app designer but whenever I try to change a label text within a callback of a button it gives me an error for the equal sign '='
app.label9.Text = 'Incorrect values';
  7 Kommentare
Basem Nabil
Basem Nabil am 9 Mai 2019
Thank you, I'm just used to other languages which use braces for block of code.
however, I've experienced another issue. The code works now but displays '...' instead of the text I assigned it to be. Do you have any clue why this happens?
Walter Roberson
Walter Roberson am 9 Mai 2019
I believe that can happen if you have set text that is wider than the width the control has been set to.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Adam Danz
Adam Danz am 8 Mai 2019
Bearbeitet: Adam Danz am 8 Mai 2019
(Continuing from comments under question)
That's not matlab syntax. Looks like cpp. If you have this opened in your matlab editor, it should be lighting up like Rudolph with red underlines.
Correct way:
if condition
% code
else
%code
end

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by