whats wrong with this app?

Hi! :)
I am attaching a small app, visualiseringsapp.
What is wrong with my switch value changed callback function?
I don’t get any plot and don’t get any error either
App3 is a big app so I am not attaching it here.
Visualiseringsapp is calling app3 as you can see.

Réponses (1)

Alberto Cuadra Lara
Alberto Cuadra Lara le 4 Fév 2024

0 votes

Hi Muazma,
I guess the property Osmotisk_data is obtained from app3, right? In that case, you should refer to
X = app.Callingapp.Osmotisk_data.samlet_vannaktivitet;
Y = app.Callingapp.Osmotisk_data.Osmotic_pressure;
and not directly from app.Osmotisk_data, because that property is not defined in visualiseringsapp.
Additionaly, I do not understand your objective with the else statement
else
plot(app.UIAxes, '','')
end

8 commentaires

Muazma Ali
Muazma Ali le 4 Fév 2024
@Alberto Cuadra Lara I want the plot to be blank if the user hasnt pushed on , on the swith . Cant I do it this way then..?
No, what you want can be done using Matlab's built-in function cla, which can be used as follows:
cla(app.UIAxes);
Muazma Ali
Muazma Ali le 4 Fév 2024
Modifié(e) : Walter Roberson le 5 Fév 2024
@Alberto Cuadra Lara I tried what you suggested but here is the error:
Error using app3/startupFcn (line 60)
Not enough input arguments.
Error in app3 (line 1993)
runStartupFcn(app, @(app)startupFcn(app, varargin{:}))
Error in visualiseringsapp/startupFcn (line 23)
app.Callingapp=app3;
Error in visualiseringsapp (line 84)
runStartupFcn(app, @startupFcn)
Error in app3/PlotresultsButtonPushed (line 1862)
visualiseringsapp
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 335)
Error while evaluating Button PrivateButtonPushedFcn.
Dot indexing is not supported for variables of this type.
Error in visualiseringsapp/SwitchValueChanged (line 34)
X=app.Callingapp.Osmotisk_data.samlet_vannaktivitet;
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 378)
Error while evaluating RockerSwitch PrivateValueChangedFcn.
>>
Alberto Cuadra Lara
Alberto Cuadra Lara le 4 Fév 2024
I see.
  • Include app3 as an input parameter (see figure attached).
  • visualiseringsapp has to be called from app3.
Muazma Ali
Muazma Ali le 5 Fév 2024
I have matlab 2018 so I dont understand how I can make app3 as an input to visualiseringsapp. I dont have the same options as you have on the right side; dont have sharing details...
Can you help me with this issue?
In addition I dont know wheter 'cla' will be acceptable in matlab 2018
Thanks
Muazma Ali
Muazma Ali le 5 Fév 2024
@Alberto Cuadra Lara I have managed to find out the solution to my problem, :)
But I have one question to you: When we use app3 as an input parameter, are we saying that all the variables from app3 can be accessed by visualiseringsapp..?
thanks
Alberto Cuadra Lara
Alberto Cuadra Lara le 5 Fév 2024
Great! No, you can only access the public properties of app3 object.
Also, the cla function was included in Matlab R2006a, so you should be able to use it.
Best,
Alberto
Muazma Ali
Muazma Ali le 5 Fév 2024
But if I have a table osmotic data and I have just declared this table public in app3 and the fields of this table as private properties, will I not be able to plot data based on the fields of osmotic data as visualiseringsapp is supposed to do..?

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by