MATLAB Answers


Create a directory, CD to the new dir and imwrite to it

Asked by Ram
on 29 Mar 2013

I would like to create a new dir, and imwrite to it. here is what I have:

newdir=mkdir('c:\results', date) % this creates a folder c:\results and subfolder with today's date.

cd (newdir) % this returns an error since string is expected.

imwrite to this folder % imwrite to c:\results\date.

thanks for inputs.



No products are associated with this question.

1 Answer

Answer by the cyclist
on 29 Mar 2013

In your syntax, newdir is a logical variable that indicates the status of whether the directory creation was successful. It is not the name of the directory.

Looks like you want




on 29 Mar 2013

Thank you very much for the solution.

the cyclist
on 29 Mar 2013

Please accept the solution to indicate your issue was solved.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!