How can I control matlab from ubuntu terminal?

3 visualizaciones (últimos 30 días)
Paschalis Garouniatis
Paschalis Garouniatis el 30 de Jul. de 2017
Comentada: Walter Roberson el 31 de Jul. de 2017
Hi everyone. I want to create a shell script which will identify a text file given from the user and then open matlab and extract data from within the text file. This is what I've done so far:
#!/bin/bash
read -p "Type desired file for data mining :" filename
echo "Selected file : $filename.txt"
cd Desktop/ocean_lab_data
vi $filename.txt
cd ../
cd ../
cd ../
cd ../
cd usr/local/MATLAB/R2016b/bin/
./matlab -nosplash -nodesktop
addpath(genpath('directory of the text file'));
A=importdata('$filename.txt');
My problem for now is that I can't pass the commands following "./matlab -no splash -nodesktop" into matlab. Any help will be much appreciated.

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Jul. de 2017
Use the -r flag
./matlab -nosplash -nodesktop -r "addpath(genpath('directory of the text file')); A=importdata('$filename.txt');"
  7 comentarios
Paschalis Garouniatis
Paschalis Garouniatis el 31 de Jul. de 2017
I tried it without the alias and it worked. Thanks a lot for your time Walter. If you have any suggestion for my previous comment please post it. Thnx again.
Walter Roberson
Walter Roberson el 31 de Jul. de 2017
At the moment I cannot think of any reason why additional arguments would be ignored if alias was used.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by