[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting a matlab proggie to work
From: |
Praedor Atrebates |
Subject: |
Re: Getting a matlab proggie to work |
Date: |
Fri, 30 May 2008 09:45:49 -0400 |
User-agent: |
KMail/1.9.9 |
On Thursday 29 May 2008 14:43:39 Praedor Atrebates wrote:
[...]
> The program takes in a set of datafiles
> named 'rawdata5.0000', 'rawdata5.0150', 'rawdata5.0300', etc, etc,
> incrementing by 0.015 with each file up to 'rawdata46.0000' or higher.
> These files contain data like this:
[...]
> And that's it. When I try to run "image_prep.m" in octave (version 3.0.0)
> I get:
>
> octave:2> run Image_preparation.m
> error: fscanf: invalid stream number = -1
> error: called from `Getting_RawData_single_channel' in
> file
> /home/praedor/Documents/BioCD/Analysis-of-SDI/Getting_RawData_single_channe
>l.m near line 37, column 10
>
> In the program file, line 37, column 10 falls in this portion of code:
>
> filnam = [fname, num2str(trackname,'%5.4f')];
> fid=fopen(filnam);
> [a,b]=fscanf(fid,'%f %f\n',[2 inf]); <--------------this line
> status = fclose(fid);
In still trying to get this matlab prog to work in octave, I have followed
some advice here and taken a look at fopen(). The help for fopen isn't (to
me) all that helpful in that my error message:
error: fscanf: invalid stream number = -1
error: called from `Getting_RawData_single_channel' in
file
/home/praedor/Documents/BioCD/Analysis-of-SDI/Getting_RawData_single_channel.m
near line 37, column 10
Doesn't tell me much. The fopen help simply tells me that a
"-1" indicates and error occurred and that the following message contains the
system message. Ok. That is nothing more than I already knew.
In looking into the code, the 'fid=fopen(filnam);' I see:
filnam = [fname, num2str(trackname,'%5.4f')];
Is this correct syntax for octave to be able to read in a series of files
named along the lines of:
rawdata5.0000
rawdata5.0150
rawdata5.0300
rawdata5.0450
...
rawdata27.0000
rawdata27.0150
etc?
The '(trackname, '%5.4f') substatement...I see the '.4' must refer to the
number of decimal places to read/accept but what of the '%5"? To what does
that refer, and given the filenames above, how would one read them all in
regardless of number sequence? The "rawdata" portion is uniform for all the
files but the numbers increment with the beginning and ending positions being
user-determined (usually I will start the files at 5.0000 and end them at
46.0000, 47.0000, or 48.0000 but this can change as per requirements at the
time).
The error appears to be with reading in the actual file names so I have to
assume an incompatibility with the way matlab does it and the way octave does
it.
praedor
--
"As democracy is perfected, the office of president represents, more and more
closely, the inner soul of the people. On some great and glorious day the
plain folks of the land will reach their heart's desire at last and the White
House will be adorned by a downright moron."
--H.L. Mencken
signature.asc
Description: This is a digitally signed message part.