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

3 commentaires

dpb
dpb le 24 Oct 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...
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!

Connectez-vous pour commenter.

 Réponse acceptée

Chris
Chris le 24 Oct 2021
Modifié(e) : Chris le 24 Oct 2021

0 votes

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 commentaires

Thanks for the response!
AS I said above, 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!
Everywhere there's an assignment -- essentially every line of code.
I see the level of the notification in the AppDesigner isn't up to the orange warning level, but if I remove a trailing semicolon from a code line, several gray lines appear in the warning indicator region and the "quality square" at the top of the edit warning column goes from green to yellow/amber, so indeed, it does give you information about them. Moving the cursor down each of those lines shows the message
Line 35: tBillYr=YearlyRestrictedAwardsUpdateEx
Line 35: Terminate statement with semicolon to suppress output...
and the couple boxes "Details" and "Fix"
The above line is the line from which I removed the trailing semicolon to create the diagnostic -- if I put it back like it was and should be (presuming I do NOT want to echo the output from the RHS to the command window, of course) like
tBillYr=YearlyRestrictedAwardsUpdateEx;
then the message goes away as well as the indicator lines.
I've learned that while you can get away with warnings and run "regular" scripts and functions with warnings, inside AppDesigner you're almost forced into keeping after it until you've removed them all.
In most of my other functions if I've got an extra return value that isn't used, I rarely bother to fix references to unused return values or some usages that are recommended to use other syntax for when I know they are only nagging and don't affect the functionality desired. Only when (but mostly IF) the code is turned into some real application or is subsequently going to be used a lot will I take the time to clean up these nits.
With the AppDesigner, however, I've discovered it doesn't much like anything and is more picky/less able to discern what is real and what isn't than the regular code editor, so I try to eliminate them all when using it.
Of course, if I'm going to the trouble to actually build and application, it's far more likely that I'm going to use it or package it for somebody else to use than code written only for my own use that may (and probably is/will be) continued to be munged on regularly if it is used further, or simply abandoned as having done its job and time has moved on leaving it behind.
Chris
Chris le 26 Oct 2021
Modifié(e) : Chris le 26 Oct 2021
Here is what I see. Sorry, I don't have an annotation app. But where I've left out a semicolon there's a highlighted block over the "=", and there are clickable warning triangles and bars at the right side of this image.
dpb
dpb le 27 Oct 2021
Interesting @Chris. Which release are you running? I'm on R2019b and as noted, the missing semicolons aren't to the level of the yellow warning, nor do I see the blob on the assignment symbol.
Maybe there's a preference somewhere, who knows....too many of 'em to try even try to find them, what more to keep 'em all straight.
Chris
Chris le 27 Oct 2021
@dpb It may be due to the color scheme I was using
(change it easily with https://www.mathworks.com/matlabcentral/fileexchange/53862-matlab-schemer but be prepared for mild disappointment).
I tried to reset the colors for this example, but I didn't restart matlab so maybe some colors didn't reset.
dpb
dpb le 27 Oct 2021
@Chris I also don't get the warning triangle for only a missing ";" just the condition indication square turns yellow instead of green -- but the clickable warning doesn't appear.
Image Analyst
Image Analyst le 27 Oct 2021
@dpb, I think you're not hovering over the yellow line in the right margin. This is what I see in R2021b and for as many prior releases as I can remember:
dpb
dpb le 27 Oct 2021
Well, now it has changed behavior here and looks similar -- I have no klew why was different yesterday, but definitely it wasn't changing state the same way as is now.
I had had some unused variables earlier as well, but had commented them out to get a clean state -- but somehow until I closed and reopened the designer it apparently didn't reset an internal flag somewhere inside the bowels of the code monitor/editor.
That's such a complex piece of code, not surprising there are some warts...but I'll agree that this appears to be the intended/normal state; just wasn't seeing that behavior here until just now and hadn't really ever thought about it before; it's a trivial detail normally don't pay much attention to.
Image Analyst
Image Analyst le 27 Oct 2021
dpb, my guess is that your mouse pointer was not exactly positioned over the orange line in the margin. The popup tooltip string with the triangle doesn't show up unless you move the mouse there.
Chris
Chris le 27 Oct 2021
@dpb, I'm running 2021b, btw.
@ErikJon Pérez Mardaras Is it possible you hadn't found the Code View yet?
dpb
dpb le 27 Oct 2021
@Image Analyst -- No, that supposition is not true. The triangle will appear on its own; in the previous state it never appeared at all; only the condition square changed color.
And, it was reproducible in adding/removing other warning conditions, errors, besides simply the existence or not of the trailing semicolon. If introduced another warning the triangle appeared and was clickable; take that warning away and it would revert to the yellow/amber square if the semicolon was missing; green if present.
Definitely a state it got into somehow...probably not reproducible but operations sequence dependent.
Image Analyst
Image Analyst le 27 Oct 2021
Oh, I see. You're talking about the symbol at the very top of the right margin. Where it shows a white checkmark in a green circle, or a white exclamation point in a yellow triangle. I was talking about the popup you get when you click on the line partway up in the right margin.
dpb
dpb le 27 Oct 2021
Those always showed and behaved as expected; simply they were not in orange but a gray hue in that state...and the actual warning condition didn't occur in conjunction with their appearance/disappearance with the state of the line-ending semicolon.
Given that visualization, I could see the OP not being able to find them as they weren't generating true warnings for me, either, at the time I read his plaintive posting! :)
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras le 27 Oct 2021
Modifié(e) : ErikJon Pérez Mardaras le 27 Oct 2021
Thaks a lot for the responses!
But I still don't know how to avoid getting those line commands on the Command Window once I run the app.
As you can see in the image below, I have putted a ";" in every single assignement instead of in the if-else loops.
Here is another example of the code on app.designer. I have putted ";" in every single assignement.
And also as you can see in the following image, the yellow warnings that pop out at my right have nothing to do with ";" issues.
Thanks a lot!
Chris
Chris le 27 Oct 2021
That's a lot of warnings. The offending line could be anywhere.
If you want to upload the code (or better yet, the whole app), it would be far easier to diagnose.
You don't have the same problem if you run a blank template app, do you?
dpb
dpb le 28 Oct 2021
Modifié(e) : dpb le 28 Oct 2021
Having 2,318 lines of code to wade through is a problem in and of itself. One of the bad things about the way AppDesigner is constructed is it doesn't number subroutines individually but the whole file.
One can help a bunch by moving non-gui code to external routines in their own m-files and call them from the app -- that goes a long way towards keeping what's actually in the designer environment manageable.
Thanks for the responses!
My app has quite more code lines than 2318 actually. By the way, my app basically consist of buttons and menus with callbacks with if-else loops within them as well as assignements as you can see in the images above.
That being said, I do not know where is the issue that makes the program write those lines on command window.
Thank you!
dpb
dpb le 28 Oct 2021
Modifié(e) : dpb le 29 Oct 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.
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!

Connectez-vous pour commenter.

Plus de réponses (2)

Image Analyst
Image Analyst le 26 Oct 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 le 28 Oct 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 commentaire

dpb
dpb le 28 Oct 2021
Modifié(e) : dpb le 28 Oct 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...

Connectez-vous pour commenter.

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by