필터 지우기
필터 지우기

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

조회 수: 20 (최근 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일
  댓글 수: 2
Stephen23
Stephen23 2019년 7월 22일
편집: Stephen23 2019년 7월 22일
"this makes a folder named s2"
Only if the variable s2 contains the characters 's2', or is a function returning those characters.

댓글을 달려면 로그인하십시오.


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
  댓글 수: 1
Stephen23
Stephen23 2019년 7월 22일
편집: Stephen23 2019년 7월 22일
"I had to use:"
mkdir([s2])
"including both the square and curly brackets."
There are no curly braces in your code.
The parentheses are either indexing or calling a function:

댓글을 달려면 로그인하십시오.

카테고리

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