Open folder, read file, close file, open new folder, read file close file etc....

Discussion in 'MATLAB' started by Phil, Mar 26, 2009.

  1. Phil

    Phil Guest

    Hello,

    My current directory has several folders within it. Each folder has the same type of file within it.

    How do i go from the current directory, into one of the folders, edit the file, then come out of the folder, then go into another folder, edit a file then come out of the folder then into a new one etc etc etc.

    If this does not make sense i apologise and will try to explain my problem a little better.

    Any help would be much appreciated.

    Cheers,

    Phil
     
    Phil, Mar 26, 2009
    #1
    1. Advertisements

  2. Phil:
    I'm not sure it makes sense. Personally I use the mouse and keyboard for doing this. Were you thinking of something else? Were you wanting to do some preset things from an m-file? If so, can't you just use cd, fullfile, fileparts, fopen, fscanf, textscan, and those sorts of things?
    Regards,
    ImageAnalyst
     
    Image Analyst, Mar 26, 2009
    #2
    1. Advertisements

  3. Phil

    Phil Guest

    What i mean is automatically cycle through the folders picking out the files, editing them, then picking another folder in the current directory, going into that folder, editing the file then moving onto the next folder within the current directory and editing that file and so on and so on until all the of the folders within the current directory have been edited.

    So i have:

    current directory = desktop\Upper Folder

    folders within current directory
    folder 1 = desktop\Upper Folder\Folder 1
    folder 2 = desktop\Upper Folder\Folder 2
    folder 3 = desktop\Upper Folder\Folder 3

    Go into each folder, edit a file, come out of a folder then move onto the next.

    I hope this makes more sense.

    Any help would be great.

    Thanks,

    Phil
     
    Phil, Mar 26, 2009
    #3
  4. Phil

    ImageAnalyst Guest

    OK That makes sense. Use the Current Directory panel of MATLAB to
    select ("go into") your folders - use the mouse for this. Then double
    click on a filename that you want to edit (again, use the mouse).
    Then an edit panel will be created. Move the mouse cursor to the
    place where you want to make your edits. Now use the keyboard keys to
    actually make the edits. Finally, use the mouse to click on the disk
    icon on the toolbar to save your edits. Repeat as many times as
    necessary.
     
    ImageAnalyst, Mar 26, 2009
    #4
  5. Rafael Herrejon, Mar 26, 2009
    #5
  6. Rafael Herrejon, Mar 26, 2009
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.