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)
Show older comments
santosh galagali
on 28 Sep 2020
Commented: santosh galagali
on 28 Sep 2020
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
Accepted Answer
Walter Roberson
on 28 Sep 2020
The parsing of DOS commands is pretty complicated. See https://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts
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)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!