Borrar filtros
Borrar filtros

How to call load_system function with the path as a variable ?

11 visualizaciones (últimos 30 días)
Nouran Adel
Nouran Adel el 3 de Jul. de 2019
Comentada: Nouran Adel el 29 de Jul. de 2019
I'm trying to get information from a simulink model to the matlab workspace then to java gui . so in java I use a matlab engine to open matlab session then I use evalAsync to execute matlab commands . first I load the simulink model using : load_system function , this works well if I include the path itself when calling the function like : load_system('C:/Users/nouu_/Desktop/untitled.slx') . But what if I want to call the function with the path as a variable like : load_system(p) and the path is stored in the variable p ?? this doesn't work with me . The idea is that I get the path as an input from the user in java gui so I store it in a variable then pass this variable to matlab workspace and load the system . what's the data type of the parameter "sys" of the function : load_system (sys) ?? I store the path in a string variable maybe it shouldn't be string and that's why I get an error !
this is the error :
java.lang.IllegalStateException: Blocking in Event Dispatch Thread not allowed
at com.mathworks.mvm.exec.FutureResult.waitInternal(FutureResult.java:316)
at com.mathworks.mvm.exec.FutureResult.get(FutureResult.java:261)
at com.mathworks.engine.FutureResult.get(FutureResult.java:44)
at com.mathworks.engine.MatlabEngine.putVariable(MatlabEngine.java:530)
  2 comentarios
Shameer Parmar
Shameer Parmar el 3 de Jul. de 2019
Yes, the datatype of the variable 'sys' should be string..
So try to store single string value into your variable sys, including the filename with its extension.. i.e. fullpath/directory + filename + extension.. this should be in single inverted commas.. as a signle string value to your variable 'sys'..
Nouran Adel
Nouran Adel el 29 de Jul. de 2019
yes it worked , thanks a lot :)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by