Filter löschen
Filter löschen

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

20 Ansichten (letzte 30 Tage)
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!

Antworten (2)

Alex Mcaulley
Alex Mcaulley am 22 Jul. 2019
Bearbeitet: Alex Mcaulley am 22 Jul. 2019
Use:
mkdir(s2)
  2 Kommentare
Stephen23
Stephen23 am 22 Jul. 2019
Bearbeitet: Stephen23 am 22 Jul. 2019
"this makes a folder named s2"
Only if the variable s2 contains the characters 's2', or is a function returning those characters.

Melden Sie sich an, um zu kommentieren.


Nicholas Byres
Nicholas Byres am 22 Jul. 2019
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

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by