MATLAB app designer too many output arguments

조회 수: 4 (최근 30일)
Chun Fai Leung
Chun Fai Leung 2022년 7월 27일
댓글: Chun Fai Leung 2022년 7월 28일
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
Dennis
Dennis 2022년 7월 28일
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
Chun Fai Leung 2022년 7월 28일
Thank Sir dpb for the help as well, problem solved. I input the incorrect name of edit field, how dumb I am. Sorry.

댓글을 달려면 로그인하십시오.

채택된 답변

Dennis
Dennis 2022년 7월 28일
There are 2 errors in this line:
app.DiffusionCoefficientmm2sEditFieldValueChanged.Value = app.DifCoeNum
First you got the name of your edit field and its callback mixed up.
Second your edit field is not numeric, so you need to convert app.DifCoeNum to a string.
This should work:
app.DiffusionCoefficientmm2sEditField.Value =num2str(app.DifCoeNum);
  댓글 수: 1
Chun Fai Leung
Chun Fai Leung 2022년 7월 28일
Oh Sir. Thank you so much. I did try using num2str before but it still pop up the "too many output arguments".
However, the main problem is that I input the incorrect edit field name. After I changed it back to the correct name of edit field, it works perfect.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by