MATLAB Answers

Calling a mat file from batch file and getting "Error: This statement is incomplete." . Matlab is opening but its throwing an error due to an IF condition in batch file.

3 views (last 30 days)
Here is the batch file code from where i am calling the mat file,
IF %DO_FILECOPY%==1 (
@echo Calling matlab
@%MATLAB_PATH% -noFigureWindows -nodesktop -nosplash -softwareopengl -wait -sd "%PLOT_SCRIPT_PATH%" -r FileCopy('"%FILE_PATH%"','"%DESTINATION%"');
)
The FileCopy file takes these FILE_PATH and DESTINATION strings as arguments. I have set DO_FILECOPY to 1.
function FileCopy(varargin)
if nargin > 0
searchPath = varargin{1};
destination = varargin{2};
end
searchPattern = '.mat$';
bRecursiveSearch = 1;
.
.
.
End of code.
Error is as follows

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 28 Sep 2020
I am not at all sure as I have very little experience with DOS shell, but I suspect that you might be running into this clause of phase 2:
If the parenthesis counter is 0 and the parser is looking for a command, then ) functions similar to a REM statement as long as it is immediately followed by a token delimiter, special character, newline, or end-of-file
The ( would not have incremented the parenthesis count because it was not looking for a command token at that point; I hypothesize that at the point of the ) that it was looking for a command. I might be misreading the intention of the description.
Anyhow, if my suspicions are correct, then you should replace the ) with ^)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!