Simulink RSIM target does not load new solver options - matlab

I'm stuck up using RSim target options.
I've created an .exe from a Simulink model "my_model" using RSim target.
Now my aim is to run this .exe and control the solver options using a .mat file.
I am trying to run the following command on CMD:
my_model.exe -i input.mat -tf 10 -o output.mat -S solver_options.mat
But the output.mat file of the model does not correspond to the sampling time I've provided in sover_options.mat.
I am following the inputs arguments provided by RSim, as shown below:
It seems that RSim is not reading new solver_options parameters.
My solver_options.mat file is provided below:
Could anyone help me, please?

Related

How to use openmodelica compiler in CLI?

I am trying to use OpenModelica compiler(omc) in the CLI, so I use the Terminalprovided in OMEdit.
I tried to debug Modelica.Blocks.Examples.PID_Controller, but it seems omc couldn't find this model.
So I duplicated the PID_Controller model and put into a folder, then switched working directory in the CLI. At this time, omc could access the model, but it couldn't find the base model of Modelica.Icon.Example, I am guessing that omc doesn't have access to the Modelica Standard Library(MSL) loaded in the OMEdit.
My question is how to let omc load the MSL correctly.
-d are debug flags used in general by the developers
If you want to use omc from command line the easiest is to use .mos scripts:
The script: c:\writable\directory\script.mos
loadModel(Modelica); getErrorString(); // load the Modelica Standard Library (MSL)
simulate(Modelica.Blocks.Examples.PID_Controller); getErrorString(); // simulate a model
plotAll(); getErroString(); // plot all variables
Then from the command line, go to a directory where you can generate some output:
cd c:\writable\directory\
omc script.mos
See all the available API (the commands you can put in a mos script) here:
https://build.openmodelica.org/Documentation/OpenModelica.Scripting.html

How do I compile and run a Matlab script in Sublime Text 3 using mcc?

I set up mcc and made a new Build System trying to get the same experience as the Command Window in Matlab.
Building an .sh file and running it with:
"shell_cmd": "mcc -m '$file'"
takes a long time and does not work properly. Surely, there must be a simpler way. How do I get the output of Matlabs Command Window in Sublime as if would run the script in Matlab?
You can directly create a build system for matlab and edit the build file as:
{
// Change path to matlab.exe per local settings
"cmd": ["C:/Program Files/MatLab/R2016b/bin/matlab.exe",
"-r", "\"run('$file')\""],
"selector": "source.matlab",
"working_dir": "${project_path:${folder}}"
}
Google and you will find more detailed instructions.

Running Matlab via PBS fails

I am trying to run Matlab 2013 via PBS and I get the following error:
libXv.so.1: cannot open shared object file: No such file or directory
I can run my code in Matlab's GUI mode though. I tried using LD_PRELOAD to point to the library as under, but that did not help either.
setenv LD_PRELOAD /usr/lib/x86_64-linux-gnu/libXv.so.1
Any suggestions on how to go about resolving this error?
When running Matlab via PBS you run actual Matlab scripts on the nodes of the cluster that probably do not have any GUI components installed including the X client libraries such as libXv.so.1.
You probably do not want to run Matlab in a GUI mode via a batch system unless it is an interactive job. In case you just want to run a script, try specifying matlab command line in your PBS script as follows:
matlab -nodisplay -nodesktop -nojvm -nosplash -r "myfunc"
Where myfunc is the Matlab command that you want to run on the cluster.

Running a C++ program from an m.file

For a project I am working on I'm preparing data in MATLAB, then running the data through a separate external application (written in C++) named Model v2.exe, then performing further analysis with the output in MATLAB. I'm trying to create an M-file which does all of this, but I am struggling to get the C++ program to launch from my MATLAB code.
How can I launch an external application from within my MATLAB code?
You can either make use of the ! operator, or the system() command.
First, rename you application to something that has no spaces in the name, like modelv2.exe. Next, either make sure it is in the system path, as defined by your system environment variables, or generate a full path to it (eg: C:\Users\Phil\Desktop\modelv2.exe).
You can call an executable program from the command line using the exclamation point or the system command:
!modelv2
or:
!C:\Users\Phil\Desktop\modelv2.exe
will cause Windows to execute the program hello.exe if there is such a file in the current directory or on the system path. Alternatively:
system('modelv2');
or
system('C:\Users\Phil\Desktop\modelv2.exe');
will do the same thing.
References
"MATLAB Central - call and run an external program in matlab under windows", Accessed 2014-03-19, <http://www.mathworks.com/matlabcentral/answers/11568-call-and-run-an-external-program-in-matlab-under-windows>

New to Matlab - Not sure how to run these files

The files I would like to run are found here:
http://www.mathworks.co.uk/matlabcentral/fileexchange/12552-multicanonical-monte-carlo-scheme-for-finding-rare-growth-factors/content/mcmc2.m
it consists of 3 files, one of which is called a driver.
I have tried running each individual one in Matlab and each one gets an error, I think this is because I need to run them all simultaneously or something?
At the beginning of the driver script it says "This is the driver script to be run from the command line. Also requires functions mcmc1 and mcmc2". Where mcmc1 and mcmc2 are the other two files I tried running it in command line but I kept getting error messages..
Any idea how I get these files to run?
You should just be able to run gf_mmc_driver from the command line in Matlab. The mcmc1.m and mcmc2.m files need to be in your matlab path, but do not need to be called directly.
However, I do notice in the driver file the following comment:
% Telling the Distributed Computing Toolbox to complete one job with
% 'numberchain' tasks. Each task is comprised of running a MCMC
% for the burnin time (mcmc1.m) with a different initial matrix.
Do you have the Distributed Computing Toolbox? The driver file appears to require it.