Prev: Capture with vcapg2
Next: Line number using fgetl
From: Mahmood on 20 Feb 2010 17:47 Hi all my problem is that i want to save a file ( or a pic) inside a specific folder say i have the script i want to use in folder named synth1 and in that folder there is a folder named memo how can i use the script to save a file inside memo folder and not in the big folder synth1 hopee my q is clear thanks
From: Walter Roberson on 20 Feb 2010 17:53 Mahmood wrote: > Hi all > my problem is that i want to save a file ( or a pic) inside a specific > folder say i have the script i want to use in folder named synth1 and in > that folder there is a folder named memo how can i use the script to > save a file inside memo folder and not in the big folder synth1 > hopee my q is clear > thanks OutputName = 'fizz7813'; save(['synth1/memo/' OutputName '.mat'], 'Var1', 'Var2'); saveas(FigureNumber, ['synth1/memo/' OutputName '.jpg']);
From: Mahmood on 20 Feb 2010 18:10 Walter Roberson <roberson(a)hushmail.com> wrote in message <hlpp5d$c26$1(a)canopus.cc.umanitoba.ca>... > Mahmood wrote: > > Hi all > > my problem is that i want to save a file ( or a pic) inside a specific > > folder say i have the script i want to use in folder named synth1 and in > > that folder there is a folder named memo how can i use the script to > > save a file inside memo folder and not in the big folder synth1 > > hopee my q is clear > > thanks > > OutputName = 'fizz7813'; > save(['synth1/memo/' OutputName '.mat'], 'Var1', 'Var2'); > saveas(FigureNumber, ['synth1/memo/' OutputName '.jpg']); thanks what if i want to read data from two folders ( named m1 and m2 ) and use this data in a script in the big folder synth1 is that possible ? thanks
From: Sadik on 20 Feb 2010 18:23 Hi Mahmood, It is always possible. As long as you type in the absolute path of the folder, you don't have anything to worry about the location of your script. Example: Your script is in C:\synth1 Your folder is D:\Data\m1\ Then, you will feed every single function with the absolute [that is, full] folder or file path like this: load('D:\Data\m1\myWorkspace.mat'); Hint: You can concatenate strings to arrive at your absolute path. For instance, if you would like to load myWorkspace1, myWorkspace2, ..., myWorkspace10 one after the other, you can say: for k = 1:10 load(['D:\Data\m1\myWorkspace' num2str(k) '.mat']); % Do what you want with the data in myWorkspacek.mat end Best. "Mahmood " <tornido2(a)hotmail.com> wrote in message <hlpq4e$i5d$1(a)fred.mathworks.com>... > Walter Roberson <roberson(a)hushmail.com> wrote in message <hlpp5d$c26$1(a)canopus.cc.umanitoba.ca>... > > Mahmood wrote: > > > Hi all > > > my problem is that i want to save a file ( or a pic) inside a specific > > > folder say i have the script i want to use in folder named synth1 and in > > > that folder there is a folder named memo how can i use the script to > > > save a file inside memo folder and not in the big folder synth1 > > > hopee my q is clear > > > thanks > > > > OutputName = 'fizz7813'; > > save(['synth1/memo/' OutputName '.mat'], 'Var1', 'Var2'); > > saveas(FigureNumber, ['synth1/memo/' OutputName '.jpg']); > > thanks > what if i want to read data from two folders ( named m1 and m2 ) and use this data in a script in the big folder synth1 > > is that possible ? > > thanks
From: ImageAnalyst on 20 Feb 2010 19:04
Mahmood: You might find sprintf() useful for building up filenames. You can also use fullfile(). You can use fileparts() to split apart filenames. To read files, you can also use fread(), textscan(), and dlmread(). There are many other useful string manipulation utilities that you should at least know exist, so you might browse the help -- especially surf the "See also" sections at the bottoms of the pages. |