[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: importdata
From: |
mallet |
Subject: |
Re: importdata |
Date: |
Thu, 22 Apr 2010 23:29:48 -0800 (PST) |
Søren Hauberg wrote:
>
>>What do you mean, "some parts are from Matlab"? Have you used code
>>developed by Mathworks?
>
> Yes, i have a licence for Matlab but without toolboxes so i use octave
> with packages from octave-forge (ode).
> The parts are :
> if nargin > 1
> delimRequested = varargin{2};
> else
> delimRequested = NaN;
> end
>
> if nargin > 2
> headerlines = varargin{3};
> else
> headerlines = 1;
> end
> and:
>
> function delimiter = fct_delimiter(FileName,delimRequested)
> % Defini le delimiteur
> if isnan(delimRequested)
> fid = fopen(FileName);
> str = fread(fid, 4096,'*char')';
> fclose(fid);
> delimPrinted = guessdelim(str);
> delimRequested = delimPrinted;
>
> else
> delimPrinted = sprintf(delimRequested);
> end
> delimiter = delimPrinted;
>
> Where guessdelim is a mfile from Matlab.
>
>>I don't know 'dlmread' (i.e. I don't use it), so I'll just ask the
>>stupid question: if the Octave implementation of 'dlmread' has to be
>>Matlab-compatible does it need to be changed?
>
> dlmread is Matlab-compatible, i used it not to rewrite importdata from
> scratch.
> But i didn’t see that dlmread fills blanks with zeros while importdata
> fills it whith NaNs.
>
>
>> I tryed using textread with option «'emptyvalue', NaN»
>> but it neither do work .
>
>>Could you come up with an example (i.e. including simple data and
>>code) ? Also, what version of Octave are you using and where did you get
>>'textread' from (the 'io' package?) ?
>
> I took textread from the io package but while in Matlab there’s an option
> emptyvalue
> which indicates how to fills blanks , it doesn’ t exist in the textread
> from io package.
>
> A ;B ;C
> 1 ;2 ;3
> 4 ;5 ;
>
> in this examples, the C column missed a 6. The Matlab' s importdata
> replace it by a NaN
> while mine replace it by zero.
>
>>P.S. Assuming you did not use any code from Mathworks, would you be
>>interested in finishing the implementation of 'importdata' and
>>publishing it for inclusion in the 'io' package?
>
> I realy would like but unfortunately i use code from Mathworks.
> The other problems is that importdata do more than my example
> (like importing data) that i have no idea how to implement it.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
--
View this message in context:
http://octave.1599824.n4.nabble.com/importdata-tp2019104p2031951.html
Sent from the Octave - General mailing list archive at Nabble.com.