Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: error on running eval and save
Date: Fri, 6 Nov 2009 12:53:14 -0500
Organization: The MathWorks, Inc.
Lines: 42
Message-ID: <hd1nog$jp4$1@fred.mathworks.com>
References: <hd1kba$dvr$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1257529936 20260 172.31.44.65 (6 Nov 2009 17:52:16 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 6 Nov 2009 17:52:16 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:583065



"Kuo-Hsien" <mchangks@hotmail.com> wrote in message 
news:hd1kba$dvr$1@fred.mathworks.com...
> Dear all,
>
> I stuck by my code for couple days. I come here to ask any guidance and 
> suggestions. Please kindly point the problems and solutions out. Thanks. 
> My purpose is to create new files contain NaNs <48x1 double> and the file 
> names are named by date. The desired file names will be picking up from a 
> <366x1 cell> tmp_filenames by ismember.
>
> The error message is:
> ??? Error using ==> eval
> Undefined function or method 'save20080101fillin' for input arguments of 
> type 'char'.
>
> What should I do?
>
> ----------------------------------
> [tf, index] = ismember(tmp_filenames,filename_4_compare);
> for n = 1:length(find(index == 0))
>    fillin_filename = [tmp_filenames(n)]
>    fillin_filename = cell2mat(fillin_filename)

If tmp_filenames is a cell array where each cell contains a file name, you 
can replace the previous two lines with:

fillin_filename = tmp_filenames{n};

>    fillin = ones(48,1) * NaN
>    eval(['save' ,fillin_filename ,'fillin -ascii'])

Remove the EVAL call and use the functional form of SAVE:

save(fillin_filename, 'fillin', '-ascii');

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ