How to pass Matlab workspace variable into system command?
조회 수: 8 (최근 30일)
이전 댓글 표시
I am using a program (wgrib) which is used to read .grb file and it runs in linux environment. This program required filename to read it. Now I want to use this programm using 'system' command in matlab. It works fine when I give the name of file but fails to execute when I give the variable which contains several file name. For ex. it works fine when I use
[u v]=system('wgrib xyz.grb') where wgrib is programm and xyz.grb is file name
But when I give it like
[u v]=system('wgrib filename')
where filename is a matlab variable which contains file name (i.e. xyz,grb), it does not execute and says didn't find file.
Can anyone suggest how to pass matlab variable in system command.
댓글 수: 0
채택된 답변
추가 답변 (2개)
cui,xingxing
2019년 1월 2일
filename = 'xyz.grb';
command = ['wgrib ',filename];
[u v] = system(command)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!