0

i made exe file from simulink model using rsim method. i followed this link how to import mat file to simulink? that means i made simulinks input to mat file called "suma", and then comppiled it, "suma" is a mat file I save my variables from GUI.

the problem is that when i change my variables in GUI, and the "suma" varibales in that mat file change, my exe file still uses the old values that i used to compile it. here is the code

a=get(handles.abroj, 'String');

b=get(handles.bbroj, 'String');

a=str2num(a);

b=str2num(b);

save('file_path_for_suma.mat','a','b');

system('file_path_for_exe_file') %this is for starting exe file?

zbroj3=load(file_path_to_output_exe_mat_file)
Community
  • 1
  • 1
mladen
  • 11
  • 1
  • 7
  • For rsim target you normally save your variables using rsingetrtp function use -p option to the executable to specify the mat file input. Have you checked any of the examples for rsim target? – Navan Mar 25 '15 at 15:31
  • thank you, i am new in creating standalone applications so i don't know which functions to use. i see now that there are a lot of examples for rsim target – mladen Mar 25 '15 at 20:19

1 Answers1

1

You're mixing up the way that Simulink works when simulating a model, and the way a simulation works when it has been converted to an executable.

A good example of the steps you will need to take can be found here: Using RSim Target for Parameter Survey.

Phil Goddard
  • 10,571
  • 1
  • 16
  • 28
  • ok, thank you, i do all that says in this link http://www.mathworks.com/help/rtw/examples/using-rsim-target-for-parameter-survey.html?refresh=true but i get error when i come to this part rtwbuild(mdlName); ??? Error using==> slbuild_private at 210 invalid simulink object handle – mladen Mar 29 '15 at 18:22
  • Can you build any models using rtwbuild? – Phil Goddard Mar 30 '15 at 04:17
  • noup, the model i'm trying to build with rtwbuild is a simple model with 2 constant blocks, an adder and scope. i just want to add two numbers together for an example, later on i wil use more complicated models. – mladen Mar 30 '15 at 08:05
  • my bad, it should have been rtwbuild('modelname'), now i can compile it. Thank you very much mr.Phil :) – mladen Mar 30 '15 at 08:54
  • mr.Phil could you help with this question as well? http://stackoverflow.com/questions/29376963/how-to-call-exe-file-made-from-standalone-simulink-model-in-m-file – mladen Mar 31 '15 at 20:14