How to call a variable from one program to another program 2 in app designer?

조회 수: 1 (최근 30일)
Ivan
Ivan 2023년 10월 15일
답변: Stephen23 2023년 10월 15일
The problem I have is that in a first program I calculate variables "a" "b" "c" "d" etc.
I want to call these variables to a second program to use them in other equations.
In the first program I have a button that opens the second program.
When running I get the following error.
Error using /
Matrix dimensions must agree.
Error in app2Class/startupFcn (line 42)
app.Tabla1.Data{1, 2} = (24/a )+(3/(a ^0.5))+0.34;
Error in matlab.apps.AppBase/runStartupFcn (line 68)
ams.runStartupFcn(app, startfcn);
Error in app2Class (line 103)
runStartupFcn(app, @startupFcn)
Error in app1/Paso2ButtonPushed (line 438)
app2Class
Error in matlab.apps.AppBase>@(source,event)executeCallback(ams,app,callback,requiresEventData,event) (line 62)
newCallback = @(source, event)executeCallback(ams, ...
Error while evaluating Button PrivateButtonPushedFcn.
I want to clarify that "a" was already calculated.
Thanks for your help.

답변 (1개)

Stephen23
Stephen23 2023년 10월 15일
I am guessing that you actually require element-wise division, not matrix division:
If you want to use MATLAB then you need to learn the difference between array operations and matrix operations.
app.Tabla1.Data{1, 2} = (24./a )+(3./sqrt(a))+0.34;

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by