Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

how can I open the folder from desktop using matlab code?

Asked by varsha

varsha (view profile)

on 30 Sep 2013
Latest activity Edited by Image Analyst

Image Analyst (view profile)

on 30 Sep 2013

I am doing a project in that i have to open the folder using Matlab code. how can I open the folder from desktop using matlab code?

1 Comment

Jan Simon

Jan Simon (view profile)

on 30 Sep 2013

It depends on what "open" and "the folder from desktop" exactly means here. Both terms could mean a variety of different things, so please add more information by appending it to the original question by editing. I've seen too many important information hidden in comments or pseudo-answers, where the readers do not expect it.

varsha

varsha (view profile)

Products

No products are associated with this question.

2 Answers

Answer by Simon

Simon (view profile)

on 30 Sep 2013

Hi!

You get the users directory in Windows with

[~, userdir] = system('echo %USERPROFILE%')

The desktop folder is in this folder.

0 Comments

Simon

Simon (view profile)

Answer by Image Analyst

Image Analyst (view profile)

on 30 Sep 2013
Edited by Image Analyst

Image Analyst (view profile)

on 30 Sep 2013

If you're using windows, you can do

winopen(folderName);

where folderName is a string, for example 'D:\MyData'. It will bring up Windows Explorer open to the folder that you specified.

0 Comments

Image Analyst

Image Analyst (view profile)

Contact us