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

1 vue (au cours des 30 derniers jours)
Ivan
Ivan le 15 Oct 2023
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.

Réponses (1)

Stephen23
Stephen23 le 15 Oct 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;

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by