How to include a command in my main.m?

I am submiting my matlab files in a server using linux. But I need to run some command lines when the server calls my main.m, how can I include this commands inside the main.m? This commands are: build mex and load('example workspace');

5 comentarios

Walter Roberson
Walter Roberson el 28 de Abr. de 2019
Any reason not to just put those lines inside your main.m ?
antlhem
antlhem el 28 de Abr. de 2019
Hi Walter. That is what I am doing, and the server gave erros e.g. "Undefined function or variable". Because I want to run the main in multiple nodes and cores, and this why I was thinking if there is a special syntax to include this commands inside the main or why the server is not running them. My submit file looks like this:
indexed_stdout = logfile
M_file = main.m
cores_per_node = 16
total_jobs = 1
I already tested something like: #$ build mex, inside the submission file but is not working
Walter Roberson
Walter Roberson el 28 de Abr. de 2019
I do not recall that build is a function in any matlab package. If you are using using Distributed Computing Toolbox then you might tell the parpool to attach the files.
I think I have seen build used by some Linux software package managers. I wonder if you need to run the command in a shell using ! or system()
antlhem
antlhem el 28 de Abr. de 2019
yea, is not a function of MATLAB is a command (as well as load) to build embedded C code in the matlab project. You can see more details on this at https://uk.mathworks.com/matlabcentral/answers/408136-ho-to-use-a-dynamic-array-in-a-mex-file-function?s_tid=prof_contriblnk
Walter Roberson
Walter Roberson el 28 de Abr. de 2019
The build given in that link is just a bunch of MATLAB code, and can be called from your main function.
It does require that MATLAB Coder be installed on the system it is running on, and perhaps that is the difficulty.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 27 de Abr. de 2019

Comentada:

el 28 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by