MATLAB Answers

how to create new folder ?

97 views (last 30 days)
afiqa  yazid
afiqa yazid on 13 Apr 2018
Edited: Stephen Cobeldick on 1 Jan 2020
How to create a new folder ? if the folder already exist , the program will add another new folder. for example, i want to create a folder named 'Image' , if the 'Image' folder already exist, program will create another folder name 'Image1' .

  0 Comments

Sign in to comment.

Answers (1)

Stephen Cobeldick
Stephen Cobeldick on 13 Apr 2018
Edited: Stephen Cobeldick on 1 Jan 2020
You could download my FEX submission nextname:
It will return the next unused file/folder name, which you can then simply use with mkdir. Each time you need a new directory simply call it with exactly this code:
name = nextname('image','1','');
mkdir(name)

  1 Comment

Stephen Cobeldick
Stephen Cobeldick on 13 Apr 2018
@afiqa yazid: my answer shows you exactly how you need to use it. I recommend that you read the Examples tab on the FEX page too.

Sign in to comment.

Sign in to answer this question.