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

1 visualización (últimos 30 días)
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.

Respuestas (1)

Stephen23
Stephen23 el 15 de Oct. de 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;

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by