Is there a way to call MATLAB from a Linux command line that would use a command line data file as input?

조회 수: 2 (최근 30일)
I'd like to automate a process by calling MATLAB from the Linux command line in such a way that the name of the input datafile is on the command line and I can eliminate the gui to locate the input file from my M-code.
Simplistically, I'm looking for a command that would look something like this: matlab my-m-code.m my-input-data-file.csv

채택된 답변

Sreeram Mohan
Sreeram Mohan 2014년 9월 19일
Try
./matlab -r "yourScript" and things should work as you expected !
Some examples method 1: ./matlab -nodesktop -nosplash -r disp('sreeram') method 2: ./matlab -automation -r disp('sreeram')
hope this helps
--sreeram mohan
  댓글 수: 2
Kathleen
Kathleen 2014년 9월 23일
Thank you for your suggestions, but how do they show the use of a csv file to be parsed and used as input for statistical processing within MATLAB?
Titus Edelhofer
Titus Edelhofer 2014년 9월 23일
You are nearly there:
matlab -r myMatlabFunction('myinputdatafile.csv');quit
You only need to make sure that MATLAB "finds" myMatlabFunction.m either on the path, or by something like
matlab -r cd('/home/kathleen/myfolder');myMatlabFunction('myinputdatafile.csv');quit
Titus

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by