What this code do?
이전 댓글 표시
I would like to know what this code does?
dos('rm *.ascii');
thanks
답변 (2개)
Geoff Hayes
2014년 6월 24일
2 개 추천
In the Command Window type help dos or doc dos. The dos function executes a DOS command and returns the result:
status = dos(command) executes the specified DOS command for Windows® platforms, and waits for the command to finish execution before returning the exit status to the status variable
The command string in this case is rm *.ascii which should remove all files with the ascii extension from the current directory.
댓글 수: 2
subha
2014년 6월 24일
Geoff Hayes
2014년 6월 24일
I should have indicated that I ran this piece of code on my Mac where the rm command is valid and so will (and did!) remove all files with the ascii extension...
Image Analyst
2014년 6월 24일
편집: Image Analyst
2020년 5월 4일
1 개 추천
Does that command even work, or does it throw an error?
For DOS, use del instead of rm. Or use the system() function instead of the dos() function.
댓글 수: 4
subha
2014년 6월 25일
Image Analyst
2014년 6월 25일
Yeah, because it's not a DOS command. Try using del instead of rm if you want to run it.
subha
2014년 6월 25일
Waqar Khan
2020년 5월 4일
Thank you
카테고리
도움말 센터 및 File Exchange에서 Search Path에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!