Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using sprintf in Matlab?

Tags:

printf

matlab

This is similar to a question I asked previously about opening a pdf in Matlab.

file = 'sl3_knt_1_2.pdf'
location = 'C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe %s'
str = sprintf(location,file);
system(str)

This returns the warning:

Warning: Invalid escape sequence appears in format string. See help sprintf for valid escape sequences. 

I think it has something to the location variable getting read as an escape sequence since it uses \ but I am not sure. I cant seem to get this to work.

like image 903
Ben Fossen Avatar asked Jan 24 '26 20:01

Ben Fossen


1 Answers

Try this:

file = 'sl3_knt_1_2.pdf'
location = 'C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe'

str = sprintf('%s %s',location, file)

system(str)
like image 99
AGS Avatar answered Jan 26 '26 16:01

AGS