Command lines appear when I run an app.

15 Ansichten (letzte 30 Tage)
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras am 24 Okt. 2021
Hello everyone,
I am making an app on "Matlab app designer" and in a near future, when I have the app done, I would like to have it like an executable, I mean, like a program.
The point is that whenever I open Matlab app designer and run my app, in the command window of matlab appears all the names and dimensions of the widgets that are on my app (boxes, menus, text, windows...etc) as you can see in the photo below.
Is this supposed to happen, or is it supposed to be the command window clear without any command line? If in a near future I would like to export my app like an executable archive, do I have to get rid off this phenomenon?
Thank you very much
  2 Kommentare
dpb
dpb am 24 Okt. 2021
You've got code lines without the output-echo-suppressing ";" at the end in your source code.
The editor will have warnings flagged for those to help you find them.
Add the ";" at the end of each code line missing one (except for "FOR", "END" and such construct lines) and it'll go away when you find and fix them all...
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras am 26 Okt. 2021
Thanks for the response!
But matlab does not tell me any warning of that kind. It does tell me warning messages, but another kind of them.
I still do not know where to put those ";". If not after a FOR or and END. Where?
Thanks!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Chris
Chris am 24 Okt. 2021
Bearbeitet: Chris am 24 Okt. 2021
It sounds like you have a line somewhere that is missing a semicolon.
If you set a property in the app but don't terminate the line with a semicolon, the Command Window will display everything about the app--just like in Matlab, if you set a variable without a semicolon, it will be displayed in the Command Window as well.
There is likely a warning present (indicated by an orange bar near the right side of App Designer, and a squiggly somwehere on the relevant line) that says "Terminate statement with a semicolon to supporess output"
  19 Kommentare
dpb
dpb am 28 Okt. 2021
Bearbeitet: dpb am 29 Okt. 2021
As @Image Analyst said earlier, maybe you have a state of the system that is equivalent to echo on
Try entering
echo off all
and see if that makes any difference.
If it does, then at least some of the output was from that; that won't stop lines that are missing their ending semicolons from still being dumped but will stop the echo if that was the problem.
Other than that, unless you clean up the warnings so there aren't so many but what you can see what the remaining ones are, all you can do is just start at the beginning and go through line-by-line seeing if you are missing a semicolon or not.
As noted, with multi-thousands of lines in a single file, that's a monumental job.
The alternative is to begin to factor the code and recast the working pieces into smaller files that can be both edited (and debugged) independently and by being smaller and independent, far more easily scanned manually for the problem of having missing semicolons (and other warnings that also should be fixed).
While you're still dealing with such a monster in one piece, you'll continue to be overwhelmed simply by the magnitude.
A second alternative would be to save the file and open it externally and use external toolsets like grep to locate offending lines.
Others have offered to look at the code for you if you'll upload it...
Beyond this, it's going to be you just slogging through rigorously from start to end finding the offending locations.
If it is echo you'll be seeing actual code lines -- that is a clue as to the symptom/cause because the missing semicolons won't echo the code; they'll just display the variable name and result.
Even that should be of at least some help -- the lines would be those assigning those variables which you could then search for.
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras am 15 Nov. 2021
I have solved the problem.
The issue was that I had several lines without the semicolon ";".
I had few lines like:
app.Box.Visible='off'
without the ";".
Thank your very much for the responses!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Image Analyst
Image Analyst am 26 Okt. 2021
You can compile with the -e option to mcc to compile your app without a console (command) window, though I don't recommend it since often error messages will pop up there and if it's not there you won't see them and won't know what went wrong.
mcc -e yourApp.m

Image Analyst
Image Analyst am 28 Okt. 2021
You might have done something like
app.NdeinputsLabel.String = 'whatever' % no semicolon
and when it hits that line, it lists all the fields of app like you've shown in your screenshot.
However, I've noticed several times now with R2021b that sometimes it lists all my lines of code regardless of whether semicolons are there or not. It's as if somehow "echo on" got turned on. I can do
echo off
and that fixes it (for a while), but I have no idea who, what, or how echo got turned on in the first place.
  1 Kommentar
dpb
dpb am 28 Okt. 2021
Bearbeitet: dpb am 28 Okt. 2021
Interesting observation that would/could explain symptoms, @Image Analyst.
I've never noticed such a phenomenon in or prior to R2020b; seems as though that symptom in R2021b would be worthy of bug report. Would certainly be annoying...
I don't recall ever using echo so I don't ever think about it even existing...it's a good thought even if OP isn't on R2021b yet to try setting it off.
I see it is another that won't echo (so to speak :) ) it's current state but is a toggle. I suppose somewhere in the bowels may be an inspectable property to determine state...

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by