matlab - 在 Matlab 中使用 sprintf?

标签 matlab printf

这类似于我之前提出的关于在 Matlab 中打开 pdf 的问题。

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

这会返回警告:

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

我认为它对作为转义序列读取的位置变量有所帮助,因为它使用\但我不确定。我似乎无法让它工作。

最佳答案

试试这个:

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

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

system(str)

关于matlab - 在 Matlab 中使用 sprintf?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12377708/

相关文章:

执行 (0 :N-1)/N * M

python - 从 Python 访问/调用 Simulink

bash - 如何在 bash 中连接使用 printf 格式化的字符串

c++ - 如何在不使用 CRT 的情况下将 double 转换为字符串

c++ - 将 printf 更改为 cout 语句

matlab - 从混淆矩阵计算灵敏度和特异性

MATLAB:如何获取枚举的所有项目的数组?

matlab - 在 Matlab 中运行时获取用户输入

c - 为什么 printf 打印错误的值?

c - fprintf 因地址突然变化导致段错误