How can I use variables in mkdir?

Hello;
Let's say I have four different variables (a, b, c, d) and I want to create folders using these variables as the name of my folder (folder name= a.b.c.d) How can I do this using mkdir?
Thanks, Tina

 Réponse acceptée

Friedrich
Friedrich le 8 Août 2013

0 votes

Hi,
what about
a = 'hello'
b = 'world'
c = 12
d = 'xxx'
mkdir([a,'.',b,'.',num2str(c),'.',d])

2 commentaires

Tina
Tina le 8 Août 2013
This works, but I dont know why for example mkdir([a,'.',b]) doesn't work
Jan
Jan le 8 Août 2013
Modifié(e) : Jan le 8 Août 2013
What does "doesn't work" mean? What happens instead? What is the type and the valuer of your variables a and b? The original question is not clear in this point.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Variables dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by