Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3980616
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:18:43+00:00 2026-05-20T05:18:43+00:00

You all here realy help me with matlab since i am a beginner. Now

  • 0

You all here realy help me with matlab since i am a beginner. Now i know a little bit about gui in matlab. I have a question. i have a figure of gui and a save button. I did this coding:

filename = inputdlg('Please enter the name for your figures');

extensions = {'fig','bmp'};

for k = 1:length(extensions

saveas(gcf, filename{:}, extensions{k})

set(gcf,'PaperPositionMode','auto')

end

But this only can save at the folder of my gui. How i want to make the user can choose which folder that he want to save the gui in .bmg file??

I use this coding as an edit from @gnovice suggestion:

filename = inputdlg('Please enter the name for your figures');

extensions = {'fig','bmp'};

directoryName = uigetdir;  %# Open directory-selection dialog

if directoryName == 0      %# User pressed the "Cancel" button...

  directoryName = '';      %#   ...so choose the empty string for the folder

end

saveas(gcf,fullfile(directoryName,fileName),extension);  %# Save to the folder

set(gcf,'PaperPositionMode','auto')

But this error occured:

??? Error while evaluating uipushtool ClickedCallback

??? Undefined function or variable 'fileName'.

Error in ==> fyp_editor>uipushtool9_ClickedCallback at 1605
saveas(gcf,fullfile(directoryName,fileName),extension);  %# Save to the folder

Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> fyp_editor at 42
    gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)fyp_editor('uipushtool9_ClickedCallback',hObject,eventdata,guidata(hObject))


??? Error while evaluating uipushtool ClickedCallback
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:18:44+00:00Added an answer on May 20, 2026 at 5:18 am

    You apparently already know about the INPUTDLG dialog box (since you use it above), so I’m surprised you haven’t also come across the UIGETDIR dialog box (or any of the others for that matter). You can use this to let the user browse and choose a folder, like so:

    fileName = inputdlg('Please enter the name for your figures');
    directoryName = uigetdir('','Please select a folder to save to');
    if directoryName == 0      %# User pressed the "Cancel" button...
      directoryName = '';      %#   ...so choose the empty string for the folder
    end
    filePath = fullfile(directoryName,fileName{1});  %# Create the file path
    extensions = {'fig','bmp'};
    for k = 1:length(extensions)
      saveas(gcf,filePath,extensions{k});  %# Save the file
      set(gcf,'PaperPositionMode','auto');
    end
    

    Note that I used the function FULLFILE to construct the file path, which automatically takes care of the file separators needed for your given platform.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

IDE = VS7 or 2002 Hi all, I have a really weird problem here.
enter code here Hi All, I have a simple windows service application that connects
I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get
Any help at all is appreciated here folks. I'm building a web app in
so I have trawled true all threads in here and any where else where
Can I optimize the class assignment here at all? I have to do this
We have a security problem here and we really need your help and inputs.
I have a piece of code here that i really could use some help
I need some help in this problem I have this matrix in MATLAB: A
All Here i want to run .sh file via system call in android NDK.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.