help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: big doubt


From: PhilipNienhuis
Subject: Re: big doubt
Date: Mon, 24 Oct 2016 06:27:10 -0700 (PDT)

Paula Manriquez Navarro wrote
> Hi,
> 
> 
>              I'm new in octave, and I already have a a problem that I didt
> find on the FAQS.
> I'm taking some EEGs with an Intan Tech system, they use a matlab script
> and it run until line 6. I already ask at intantech mail, and as they dont
> use octave they dont know.
> 
> Here is the first piece of the script (in red where is the "problem"):
> 
> 1  function[t,amps,data,aux] = read_intan_data4
> 2  [file, path, filterindex] = uigetfile('*.int','Select a .int
> file','MultiSelect', 'off');
> 3  filename = [path,file];
> 4  fid = fopen(filename,'r');
> 5  for i=1:3
> 6 header(i)=*(fread(fid, 1, 'uint8'));*
> 7  end
> 
> ****I used at line 6 3 different variants
> a) header(i)=*double(fread(fid, 1, 'uint8')); and *
> b) header(i)=
> *(fread(fid, 1, 'int8'));*c) header(i)=
> 
> 
> *double(fread(fid, 1, 'int8'))*
> And here is the answer:
> 
>>> read_intan_data4.m
> error: read_intan_data4: A(I) = X: X must have the same size as I
> error: called from:
> error:   /home/cantaritodeagua/octave/javier/1003/read_intan_data4.m at
> *line
> 6, column 14*
> 
> 
> I dont know if this mail is the rigth place to receive my question, as
> I've
> been saying, I saw this script working in matlab, but no one knows how to
> make it work. I send you the complete original script.
> My octave have a lot of packages installed (almost all of them), and I
> made
> a good instalation, I  have it like 2-3 weks ago installed.
> 
> I hope you can help me, please, I feel already stupid enough.

Sorry for the problem you encountered.

With the file read_intan_data.m you supplied, using octave-4.0.3 and 4.3.0+
on Windows 7 I get:

================================
>> read_intan_data
error: Improper data file format.
error: called from
    read_intan_data at line 36 column 5
================================

which shows that Otave gets past the offending fread line. IOW, I can't
reproduce it.

However if I enclose the fread RHS in parenthese like you did, I get the
same error you got. 

If you try:

header(i)=uint8 (fread(fid, 1, 'int8'))

the whole thing should work.

Actually the entire for loop invoking that fread statement could more
efficiently be replaced by one line:

header = fread (fid, 3, 'uint8');

That works fine for me as well in read_intan_data.m.

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/big-doubt-tp4680319p4680328.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]