From: Raphael on
I have compiled a function that takes a string as input. It worked well from the matlab prompt.

function strout=system2(string)

[~,strout]=system(string);
A=textscan(strout,'%s');
strout=cell2mat(A{1});
disp(strout)


Now, once compiled, I write a bash-shell script to execute it :

../system2 "mystring_with_white_spahces"
It works like a charm

but with this :

string= "mystring_with_white_spaces"
../system2 $string (doesn't work, got too many input arguments)
../system2 ${string} (same as previous)

tried also with export string= "mystring_with_white_spaces"
which doesn't work either, same error, too many input arguments.

How shall I pass the unique string as an argument ? I need to do batch processing, I can't put the regular expression directly next to the function name...
Any idea ?

Thanks