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

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

Post by Phil » Fri, 27 Mar 2009 20:42:01


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
 
 
 

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

Post by Image Anal » Fri, 27 Mar 2009 21:21:01

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

 
 
 

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

Post by Phil » Fri, 27 Mar 2009 21:42:01


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
 
 
 

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

Post by ImageAnaly » Sat, 28 Mar 2009 03:07:20

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.
 
 
 

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

Post by Rafael Her » Sat, 28 Mar 2009 08:15:05

I guess the editing is automatical as well...

for Low-Level File I/O Functions check out
http://www.yqcomputer.com/

if you know the names and path of the files, u just need to change the filename string in fopen
 
 
 

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

Post by Rafael Her » Sat, 28 Mar 2009 08:19:01

check this thread http://www.yqcomputer.com/

its pretty much your same question, before posting, try to search the previous posts.