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

1 Ansicht (letzte 30 Tage)
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.

Antworten (1)

Stephen23
Stephen23 am 15 Okt. 2023
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;

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by