How can I save a file in the directory where the user chooses the file location and file name?

2 views (last 30 days)
I want to create a save function to save .mat files with specific variables in the workplace. I'm aware that
save(filename, variables)
will save my variables within the program under a specified folder name. However I want the user to be able to save wherever they want, and to save with a name of their choice.
For example, in Microsoft Word, you can save your file wherever you want in your directory and choose it's name. I want to know how to do the same thing for my program.
.
If this isn't applicable, I would at least like to know how to get the file name they input themselves, and have a designated folder outside the program. I can't find any answers to this question :(
  3 Comments
Brianna Florio
Brianna Florio on 6 Jun 2018
Thank you! This worked!
But now I have a follow up question, how do you allow the user to load a file of their choice? Is it the same function or a different function?
Paolo
Paolo on 6 Jun 2018
You are welcome, I believe that for loading a file what you want is uiopen. If that solved the problem, let me know and I will write up an answer for your question, for it to be accepted and for the question to be closed.

Sign in to comment.

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!