Path: news.mathworks.com!not-for-mail
From: "Sadik " <sadik.hava@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: save inside a specific folder
Date: Sat, 20 Feb 2010 23:23:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 48
Message-ID: <hlpqsm$4i9$1@fred.mathworks.com>
References: <hlpop7$pc8$1@fred.mathworks.com> <hlpp5d$c26$1@canopus.cc.umanitoba.ca> <hlpq4e$i5d$1@fred.mathworks.com>
Reply-To: "Sadik " <sadik.hava@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1266708182 4681 172.30.248.37 (20 Feb 2010 23:23:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 20 Feb 2010 23:23:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1666517
Xref: news.mathworks.com comp.soft-sys.matlab:610080

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@hotmail.com> wrote in message <hlpq4e$i5d$1@fred.mathworks.com>...
> Walter Roberson <roberson@hushmail.com> wrote in message <hlpp5d$c26$1@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