Hi,
I've written (thanks also to this newsgroup!) the following script
for opening multiple files, e.g.:
test_0001
test_0002
....
for i=1:N
xx=sprintf('%4d',i);
tag=strrep(xx,' ','0');
all=['test_',tag,'.txt'];
fid = fopen(all, 'at');
end
this allows to create all the files in the /work matlab subfolder.
I need to create these files in a subdirectory such as
/work/test
How can I manage it?
Thanks for helping
|
|
0
|
|
|
|
Reply
|
mail.plutus (24)
|
5/27/2005 7:35:16 AM |
|
Bart wrote:
>
>
> Hi,
>
> I've written (thanks also to this newsgroup!) the following script
> for opening multiple files, e.g.:
> test_0001
> test_0002
> ...
>
> for i=1:N
> xx=sprintf('%4d',i);
> tag=strrep(xx,' ','0');
> all=['test_',tag,'.txt'];
> fid = fopen(all, 'at');
> end
>
> this allows to create all the files in the /work matlab subfolder.
>
> I need to create these files in a subdirectory such as
> /work/test
>
> How can I manage it?
>
> Thanks for helping
take a look at FULLFILE
myfullfile = fullfile(mydir, myfilename) ;
btw, avoid using function names (ALL) as variable names ...
Jos
|
|
0
|
|
|
|
Reply
|
Jos
|
5/27/2005 8:14:55 AM
|
|
Hi Bart,
I guess your files are created in a folder something like
C:\Program\MATLAB7\work. Before you create the files you must change
the current directory to C:\Program\MATLAB7\work\test. It can be done
like this
filePath='C:\Program\MATLAB7\work\test'
cd(filePath)
Commands such as mkdir, dir, fileparts, mfilename, path, pwd, what,
dir, fileattrib, filebrowser, fileparts, ls, mfilename, movefile,
rmdir and so on may also be useful when handling files.
I hope this helps.
Markus
Bart wrote:
>
>
> Hi,
>
> I've written (thanks also to this newsgroup!) the following script
> for opening multiple files, e.g.:
> test_0001
> test_0002
> ...
>
>
> this allows to create all the files in the /work matlab subfolder.
>
> I need to create these files in a subdirectory such as
> /work/test
>
> How can I manage it?
>
> Thanks for helping
|
|
0
|
|
|
|
Reply
|
maslit98 (5)
|
5/27/2005 8:17:30 AM
|
|
Markus Lindkvist wrote:
>
>
>
> filePath='C:\Program\MATLAB7\work\test'
> cd(filePath)
>
It works!!
Thanks alot for helping ;)
|
|
0
|
|
|
|
Reply
|
mail.plutus (24)
|
5/27/2005 8:37:14 AM
|
|
|
3 Replies
16 Views
(page loaded in 0.069 seconds)
Similiar Articles: Script to check files in adirectory older than X hours - comp.unix ...hi guys , I need to develop a script to check for all files in a directory that ... system I accessed (HPUX today) and it is able to create a file with an mtime specified to ... Save output image file in a specified folder - comp.graphics.apps ...Save output image file in a specified folder - comp.graphics.apps ... Remember location on save, re-open? - comp.emacs Save output image file in a specified folder - comp ... save to specified folder - comp.soft-sys.matlab... saveas() to save files in a specified ... way paths are specified. You can also change directory in ... on save, re-open? - comp.emacs Save output image file in a specified ... Custom Property Rename - comp.cad.solidworks... something that does everything in a single directory. ... macro that saves a pdf of all drawing files in a specified ... to that of selected property -does not open file in ... Odd BACKUP error: unsupported file structure ! - comp.os.vms ...The other *.EPS files in that directory are also Stream ... specified> > Modified: =A0 <None specified> > Linkcount: =A01 > File ... errors: One expecs some "file is open, but ... Transferring Data folder to Win7 -- no luck yet - comp.mail.eudora ...When I would try to open it, it would go to a window with the message: "The directory specified in the datafolder entry of the deudora.ini file: c:\program files\eudora ... Cannot open output file (for executable) - comp.compilers.lcc ...Cannot open output file (for executable) - comp.compilers.lcc ... Save output image file in a specified folder - comp.graphics ... used in the docmentation for directory, file open two files side by side - comp.emacsI want to be able to open files in emacs side by side ... My blind guess is that in those cases, you specified the files ... in /home/ed/sub, the value of `default-directory ... IE can't display Sun ftp files and directories - comp.unix.solaris ...... Internet Explorer does not properly display file and directory listings. The probles exists unless all files ... you set up the environment for your ftp daemon as specified in ... How to save files into a specific folder - comp.soft-sys.matlab ...Save output image file in a specified folder - comp.graphics.apps ... How to save files into ... Open Save Dialog box using Virtual Folders - comp.lang.javascript ... How to ... Matlab: opening of files in a specified directory - programming ...programming.itags.org: Matlab question: opening of files in a specified directory, created at:Wed, 30 Apr 2008 23:06:00 GMT with 547 bytes, last updated: Wednesday ... List Files in a Directory - VB.NET sample code - developer FusionOpen Source; Mobile; Database; Architecture; RIA & Web; Toolbox ... 'list the names of all files in the specified directory For Each dra In diar1 7/22/2012 2:34:15 PM
|