[Top][All Lists]

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

Re: function won't run

From: Nicholas Jankowski
Subject: Re: function won't run
Date: Sat, 24 Oct 2015 14:46:16 -0400

On Oct 24, 2015 7:44 AM, "Jonathan Camilleri" <address@hidden> wrote:
> I think I am doing something wrong, can you provide specific help?
> I don't know how to call this function from the command window to test it or how else can 
> I test it, usually I do testing in the small before I write unit tests, possibly using other frameworks.
> See attached source code and data that was taken from
> function getData (filename)
> fid = fopen(filename);
> header = fgetl(fid);
> y = zeros;
> X = zeros(1,num_pixels, * num_pixels)
> counter = 0;
> while(!feof(fid))
>   eachline = fgetl(fid);
>   [label, imagedata] = parseline[eachline, num_pixels);
>   if (counter == 0)  {
>       y = label;
>       X = imagedata;
>   } endif
>   counter++
>   endwhile 
>   fclose(fid);
> %Sourced from
> }
> --
> Jonathan Camilleri
> Mobile (MT): ++356 7982 7113
> E-mail: address@hidden
> Please consider your environmental responsibility before printing this e-mail.
> I usually reply to emails within 2 business days.  If it's urgent, give me a call.
> _______________________________________________
> Help-octave mailing list
> address@hidden

Please use subject lines in your emails. Sorting through your multiple subject-less help requests I'd more difficult than it should be. Please makes things easier on the people trying to help you.

When something doesn't work, copy&paste the exact command used and exact error received. Otherwise you're asking us to waste our time guessing. As someone else mentioned, you can use the diary command:
>> help diary

For this one, you posted the text of a getdata function, but the file you posted has a different name, and it appears to contain getdata. How will octave find the function?

The top level function in an m file should have the same name as the file. Any other functions in that file can only be called as subfunctions of that main function.

And the syntax must be correct. Fix the naming issue and use the manual to figure out where your syntax errors are when octave points them out.


reply via email to

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