What this code do?

回答(2 个)

Geoff Hayes
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 个评论

thanks
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
Image Analyst 2014-6-24
编辑:Image Analyst 2020-5-4

1 个投票

rm is a Unix command: https://en.wikipedia.org/wiki/Rm_%28Unix%29 not a DOS command.
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 个评论

I am getting this warning.
'rm' is not recognized as an internal or external command, operable program or batch file
Yeah, because it's not a DOS command. Try using del instead of rm if you want to run it.
ok. thanks
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!

Translated by