help-octave
[Top][All Lists]
Advanced

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

Re: Cannot get simple matlab programs to run in octave 3.0.0


From: Jaroslav Hajek
Subject: Re: Cannot get simple matlab programs to run in octave 3.0.0
Date: Sat, 24 May 2008 22:22:18 +0200

On Fri, May 23, 2008 at 9:49 PM, Praedor Atrebates <address@hidden> wrote:
> I have a set of simple matlab programs that I have been trying to get running
> in octave 3.0.0 without success.
>
> I have a bunch of datafiles containing two columns of data, thus (partial):
>
> -4.220000E-2    4.274234E-1
> -4.219600E-2    4.270094E-1
> -4.219200E-2    4.272766E-1
> -4.218800E-2    4.273062E-1
> -4.218400E-2    4.275531E-1
> -4.218000E-2    4.272766E-1
> -4.217600E-2    4.274953E-1
> -4.217200E-2    4.275594E-1
> -4.216800E-2    4.275188E-1
> -4.216400E-2    4.270891E-1
> -4.216000E-2    4.271687E-1
> -4.215600E-2    4.270141E-1
> -4.215200E-2    4.271734E-1
> -4.214800E-2    4.273188E-1
> -4.214400E-2    4.275016E-1
> -4.214000E-2    4.275141E-1
> -4.213600E-2    4.271406E-1
> -4.213200E-2    4.274656E-1
> -4.212800E-2    4.273219E-1
> -4.212400E-2    4.269547E-1
>
> I have a set of matlab programs and functions that takes thousands of files
> containing data like that above and combines it into one single big file.
>
> The initial processing program contains (for the moment) just:
>
> # Rawdata read-in program.
> # The parameter 1: the pitch length;
> # The parameter 2: start position;
> # The parameter 3: number of tracks;
> # The parameter 4: The forth is pixel number for one period of scan;
> # The parameter 5: The path to the folder keeping rawdata
>
> # ILscan1 =
> Getting_RawData_single_channel(0.015,-42,2400,12500,'C\Data\praedor\custom1038-2155\scan1\');
>  ILscan2 =
> Getting_RawData_single_channel(0.015,5,2620,12500,'/home/praedor/smb4k/bind222-ml/Data/praedor/custom1038-2172/scan2/');
> # ILscan3 =
> Getting_RawData_single_channel(0.015,0,2700,12500,'c\Data\praedor\custom1038-2155\scan3\');
>
> I simply uncomment the appropriate line and edit the path to the rawdata.  In
> the above example my ILscan2 line is uncommented and points to rawdata for
> processing in the samba directory listed.  That location contains 2620 files,
> each containing data like that listed above.
>
> The Getting_RawData_single_channel function is:
>
>    # SurAnal.m
> # 2D Analysis program for PC disks and chips
> # Creates surface topology, then demodulates the carrier frequency
>
>
> # User Input            # User modified parameters
> function IL =
> Getting_RawData_single_channel(itrack,startrackpos,endtrack,endtime,folderpath)
> startrack = 1;          # Starting track number
> wspin = 1200;           # Spin frequency
> startime = 1;           # Starting time
> dt = 1e-6;              # time increment
>
>
> fname = [folderpath,'rawdata'];
>
> periodic = 0.9042*1024; # adjustable carrier frequency
> df = 20e3;              # demodulation bandwidth (30e3)
> dny = 0.2;              # demoduulation radius width (0.80)
>
> #S = pwd;
> #[s1,s2] = size(S);
> #dat = S(s2-4:s2);
>
> dtrack = endtrack-startrack+1;      # Size of matrix in radius dimension
> dtime = endtime-startime+1;         # Size of matrix in time dimension
>
> # Loop through tracks
> tracknum = startrack - 1;
> for trackloop = 1:dtrack
>    tracknum = tracknum +1;
>
>    x = 1:dtime;
>    t = dt*x;
>
>    trackname = startrackpos + (tracknum-1)*itrack;
>
>    filnam = [fname, num2str(trackname,'#5.4f')];
>    fid=fopen(filnam);
>    [a,b]=fscanf(fid,'#f    #f\n',[2 inf]);
>    status = fclose(fid);
>
> #    temp = a(2,startime:endtime);           # amp data values
>    #avg2 = mean(temp2);
>
> #    temp2 = a(3,startime:endtime);           # phase data values
>    #avg = mean(temp);
>    #yphase = (temp - avg)/avg2;
>
>
> # Subtract linear drift in data
>
> IL(trackloop,1:dtime) = a(2,startime:endtime); #temp(1:dtime);        #
> Amplitude topology
> endfor     # trackloop
>
> return;
>
> As far as I can tell there is nothing in either program/script/function that
> isn't compatible with octave, but I am a newbie to octave.
>
> When I try to run the Image_prep program in qtoctave I get:
>
>>> Image_preparation_withoutlandremove
> error: fscanf: invalid stream number = -1
> error: evaluating for command near line 29, column 1
> error: called from `Getting_RawData_single_channel' in file
> `/home/praedor/Docu
> ments/BioCD/Analysis-of-SDI/Getting_RawData_single_channel.m'
> error: evaluating assignment expression near line 9, column 10
> error: near line 9 of file
> `/home/praedor/Documents/BioCD/Analysis-of-SDI/Image
> _preparation_withoutlandremove.m'
> error: source: error sourcing file
> `/home/praedor/Documents/BioCD/Analysis-of-S
> DI/Image_preparation_withoutlandremove.m'
> error: remove_breakpoint: unable to find the function requested
> error: fscanf: invalid stream number = -1
> error: evaluating for command near line 29, column 1
> error: called from `Getting_RawData_single_channel' in file
> `/home/praedor/Docu
> ments/BioCD/Analysis-of-SDI/Getting_RawData_single_channel.m'
> error: evaluating assignment expression near line 9, column 10
> error: near line 9 of file
> `/home/praedor/Documents/BioCD/Analysis-of-SDI/Image
> _preparation_withoutlandremove.m'
>
>
> If I try to run the program from the octave CLI I get nothing.  No output, no
> error messages, nothing.
>
> What is wrong?
>
> patrick
> --
> "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
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>

I'd suggest dumping the value of filnam in the for loop, to check that
it really produces the file names it should. Otherwise, as you can
easily guess, if you describe the error as "nothing happens", even if
it is an accurate description, it is hard for anyone to help unless
you give enough data to reproduce the problem.
Normally, a good approach is to gradually remove functions, statements
and datafiles as long as the problem persists, then post the best what
you achieved.

-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

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