How do I make a new folder and then name it using the string stored within a variable.

18 次查看(过去 30 天)
I have named a variable s2. The string stored within s2 is '3 min RT'.
I want to create a new folder named "3 min RT".
At the moment when I use mkdir s2, the folder created is called s2 and not "3 min RT".
Anyhelp please? Thanks!

回答(2 个)

Alex Mcaulley
Alex Mcaulley 2019-7-22
编辑:Alex Mcaulley 2019-7-22

Nicholas Byres
Nicholas Byres 2019-7-22
I have now figured this out. I had to use:
mkdir([s2])
including both the square and curly brackets. Can anyone explain exaclty why for future reference?
Thanks

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by