MATLAB app designer too many output arguments
Show older comments
I wrote an app for particle tracking. Data is stored in a Excel datasheet.

I would like to create a "calculate Diffusion Coefficient" button and the Row 1, Column 14 data will displayed on the diffusion Coefficient edit field. However, when I used the following code, it show the "too many output arguments" and I searched and still don't know how to solve it. Could anyone helped me solve this please. Appreciate it a lot.
% Button pushed function: CalculateDiffusioncoefficientButton
function CalculateDiffusioncoefficientButtonPushed(app, event)
dataset = xlsread('modifiedDataset.xlsx','Sheet1')
app.DiffusionCoefficientmm2sEditFieldValueChanged.Value = dataset(1,14)
I even tried add a private property but it still doesn't work.
% Button pushed function: CalculateDiffusioncoefficientButton
function CalculateDiffusioncoefficientButtonPushed(app, event)
dataset = xlsread('modifiedDataset.xlsx','Sheet1')
app.DifCoeNum = dataset(1,14)
app.DiffusionCoefficientmm2sEditFieldValueChanged.Value = app.DifCoeNum
7 Comments
Show us the whole error in context...we can't tell what it thnks is the offending code.
Although I notice you're missing the trailing semicolons on the assignment statements which try to echo output -- I dunno off top of head if that bothers the app designer or not since there isn't a console to which to echo the output, but I'd try fixing that firstest...
Chun Fai Leung
on 28 Jul 2022
Edited: Chun Fai Leung
on 28 Jul 2022
dpb
on 28 Jul 2022
How about pasting image of the screen with the error message, then? It's got to highlight the offending line somehow...
It's not convenient to load another app at the moment with present state of workspace; alternatively, comment out the code inside the function to nothing and try again; then add code back one step at a time.
I might even just delete the callback function entirely and start over with redefining it from scratch.
I do notice there's a red underline under both xlsread and value above; what does
which -all xlsread
which -all value
whos xlsread
whos value
return? Any chance have accidentally renamed xlsread to be a variable or the like???
Dennis
on 28 Jul 2022
If you want to set the value of your edit field it should be
app.DiffusionCoefficientmm2sEditField.Value = app.DifCoeNum;
Not sure if it resolves the error.
dpb
on 28 Jul 2022
value=app.DiffusionCoefficientmm2sEditField.Value;
should just retrieve the current content of the edit field -- of course, value at this point is only a local variable within the callback function that doesn't get used or saved nor is it visible anywhere else, but just looking I don't see why it should be a syntax error.
Probably creating the global shared variable and then referring to
app.value
would be appropriate assuming the value is going to be needed somewhere else besides in whatever else this callback was going to do with it.
I dunno, I've seen some pretty picky issues inside appdesigner on syntax, though, now that think about it -- it definitely gets all bent out of shape with non-referenced variables, although I don't recall it being more than nagging and excessive wanting to replace by ~ while one is still under development/testing.
Dennis
on 28 Jul 2022
value=app.DiffusionCoefficientmm2sEditField.Value;
That line is created by appdesigner automatically when you add a ValueChanged callback to an editfield. But you are correct that in this case the line does nothing and value is not getting used or stored.
Chun Fai Leung
on 28 Jul 2022
Accepted Answer
More Answers (0)
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!