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

Thread Subject:
Recognize path in save dialog for future save dialog boxes

Subject: Recognize path in save dialog for future save dialog boxes

From: Maxx Chatsko

Date: 16 Jul, 2010 19:05:20

Message: 1 of 3

Hello all,
    I have several save dialog boxes that pop-up one after the other using uiputfile. The first time the dialog appears the user must select a folder for saving the data. I want the consecutive save dialog boxes to recognize the path/folder that the user selected in the first save dialog box. There has to be a way to do this with case? My code is as follows:

%Setup for to save FCI .spc
        if save_fci==1;
 %Prompt user with save dialog box
[filename_edit,text_path,filterindex]=uiputfile({'*.spc','SPC File (*.spc)';...
                                      '*.*','All Files (*.*)'},'Save FCI Spectra');

         %Return to PSLprcsr.m if the save dialog box is closed before saving
           if text_path==0;
               return
           end
         %Create path and filename for GSSpcWrite.m
               fci_spc=char(strcat(text_path,filename_edit));
          global SUPER_FCI WL_FCI
               GSSpcWrite(fci_spc,SUPER_FCI,WL_FCI); %Save FCI data as .spc file
        end

    text_path is the variable that is passed along to other functions and handles of the other checkboxes. Any idears?
        Thanks
        Maxx
        

Subject: Recognize path in save dialog for future save dialog boxes

From: Jan Simon

Date: 17 Jul, 2010 12:24:08

Message: 2 of 3

Dear Maxx,

1. As mentioned in the help of UIPUTFILE, a 3rd input can specify the destination:
  [filename1, filepath1] = uiputfile('*.png', 'Choose a file');
  [filename2, filepath2] = uiputfile('*.png', 'Choose a file', fullfile(filepath1, '*.png');

2. Change the current directory after the first UIPUTFILE:
  bakCD = cd;
  [filename1, filepath1] = uiputfile('*.png', 'Choose a file');
  cd(filepath1);
  [filename2, filepath2] = uiputfile('*.png', 'Choose a file');
  cd(bakCD);

Good luck, Jan

Subject: Recognize path in save dialog for future save dialog boxes

From: Maxx Chatsko

Date: 18 Jul, 2010 00:41:03

Message: 3 of 3

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de>
> 2. Change the current directory after the first UIPUTFILE:
> bakCD = cd;
> [filename1, filepath1] = uiputfile('*.png', 'Choose a file');
> cd(filepath1);
> [filename2, filepath2] = uiputfile('*.png', 'Choose a file');
> cd(bakCD);

    Works like a charm. Thanks
              Maxx

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us