Prev: Capture with vcapg2
Next: Line number using fgetl
From: Mahmood on 20 Feb 2010 19:17 thanks for your help d u know how to save to a path with many variables example : i have a script that saves a file with 10 variables the command is save ('a.txt','s','n',.....) how can i set a path to save this file in a folder named ,say, leg1 i tried savepath leg1/('a.txt','s','n',.....) did not work any help ??? cheers i have "Sadik " <sadik.hava(a)gmail.com> wrote in message <hlpqsm$4i9$1(a)fred.mathworks.com>... > 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 21 Feb 2010 00:02
Mahmood: You need to learn to read the documentation. save() saves a file. savepath() saves a search path. You can't do this: savepath leg1/('a.txt','s','n',.....) It doesn't make any sense. So what are you asking? How about this: fullFileName = fullfile('c:\leg1', 'a.mat'); save(fullFileName, 's', 'n'); It's all spelled out there in the documentation for those two functions. |