在 octave system/unix 命令中包含内部创建的字符串?
including internally created strings in octave system/unix command?
我有一个像这样的脚本:
#!/opt/bin/octave -qf
xin = dlmread(argv(){1},",");
tim = dlmread("Time");
fileout = [argv(){1} "-" "avg"];
## calcs to create xtemp and time matrices
dlmwrite("Time-avg",time);
dlmwrite(fileout,xtemp,",");
## ?? unix("paste -d',' Time-avg fileout > DATCOARSE");
在最后一行之前一切正常。我在脚本中创建 fileout 以与输入数据文件相关联,并且 fileout 打印出来很好。
在 unix 或系统命令中使用 "fileout" 的八度中是否有某种取消引用运算符?
您可以使用 sprintf 创建命令字符串:
cmd_str = sprintf ("paste -d',' Time-avg %s > DATCOARSE", fileout);
unix (cmd_str)
但您根本不必使用 "paste"。您可以在八度
中连接矩阵
dlmwrite ("DATCOARSE", [time, xtemp], ",");
我有一个像这样的脚本:
#!/opt/bin/octave -qf
xin = dlmread(argv(){1},",");
tim = dlmread("Time");
fileout = [argv(){1} "-" "avg"];
## calcs to create xtemp and time matrices
dlmwrite("Time-avg",time);
dlmwrite(fileout,xtemp,",");
## ?? unix("paste -d',' Time-avg fileout > DATCOARSE");
在最后一行之前一切正常。我在脚本中创建 fileout 以与输入数据文件相关联,并且 fileout 打印出来很好。
在 unix 或系统命令中使用 "fileout" 的八度中是否有某种取消引用运算符?
您可以使用 sprintf 创建命令字符串:
cmd_str = sprintf ("paste -d',' Time-avg %s > DATCOARSE", fileout);
unix (cmd_str)
但您根本不必使用 "paste"。您可以在八度
中连接矩阵dlmwrite ("DATCOARSE", [time, xtemp], ",");