Reputation: 1
so i put the following statement in a batch file
matlab -nosplash -nodesktop -minimize -nodisplay -r fact('%~f1','%~f2');
and run the batch file with two arguments, basically just drag two files to the CMD window right after the batch file name. but in the Matlab command window it gives me error: String is not terminated properly. but when i run it in the Matlab software it gives me no error, how do I solve this?
the fact.m is just a simple Matlab script
function fact(file1,file2)
f1 = importdata(file1);
f2 = importdata(file2);
vec1 = f1(:,1);
vec2 = f2(:,1);
vec = vec1 + vec2;
save vec.txt vec -ascii
i want to importdata from two files and extract two vectors and then combine them and save to a file
Upvotes: 0
Views: 469
Reputation: 49719
According to your comment, a space in the folder name seems to be the problem. Try to change the batch code to this:
matlab -nosplash -nodesktop -minimize -nodisplay -r fact('"%~f1"','"%~f2"');
If this doesn't work, look for ways to encapsulate the -r
parameter.
Upvotes: 0