# "size(foo)" vs "size foo" (octave-3.4.3)

10 messages
Open this post in threaded view
|

## "size(foo)" vs "size foo" (octave-3.4.3)

 Hello, here is a screen session excerpt: " octave:18> size(foo) ans =    8192      1 octave:19> size foo ans =    1   3 octave:20> ". I have no problem with "    8192      1 " output - it is the way it is supposed to be. OTOH, I do not understand the "    1   3 " output. I don't understand it even more since: " octave:25> size(a234567) ans =    8192      1 octave:26> size a234567 ans =    1   7 ", i.e. it looks like the second number ("3" in case of "size foo" and "7" in case of "size a234567" is the variable name length in characters. And what does the first "1" mean in the "size foo" case ? Is "size foo" output displayed the way it is supposed to be ? If "size foo" is illegal, I'd prefer to see an error message. If it is legal, why the result is different from "size(foo)" ? Thanks,   Sergei. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 ----- Original Message ----- > From: Sergei Steshenko <[hidden email]> > To: "[hidden email]" <[hidden email]> > Cc: > Sent: Friday, February 3, 2012 5:39 PM > Subject: "size(foo)" vs "size foo" (octave-3.4.3) > [snip] Octave version is actually 3.4.2. Regards,   Sergei. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 In reply to this post by Sergei Steshenko > octave:18>  size(foo) > ans = > >     8192      1 A matrix with 8192 rows and 1 column (i.e., a column vector) > > octave:19>  size foo > ans = > >     1   3 A matrix with 1 row and 3 columns, i.e., the string "foo". It seems that if you use "size" without the parenthesis it interpretes the argument as a string... _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 In reply to this post by Sergei Steshenko On Fri, 2012-02-03 at 16:39 +0100, Sergei Steshenko wrote: > octave:18> size(foo) > ans = > >    8192      1 > > octave:19> size foo > ans = > >    1   3 Of course.  Why does this surprise you?  Seriously.  You should learn about the difference between function and command syntax. A good place to start is http://www.gnu.org/software/octave/doc/interpreter/Commands.html#CommandsSincerely, -- Bård Skaflestad <[hidden email]> SINTEF ICT, Applied Mathematics _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 In reply to this post by Ismael Diego Nunez-Riboni On 3 February 2012 11:03, Ismael Núñez-Riboni <[hidden email]> wrote: > It seems that if you use "size" without the parenthesis it interpretes the > argument as a string... This is true of *all* Octave functions.     foo a b c d; is *exactly the same* as     foo("a", "b", "c", "d"); See here:     http://www.gnu.org/software/octave/doc/interpreter/Commands.htmlHTH, - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 On 02/04/2012 12:10 AM, Jordi Gutiérrez Hermoso wrote: > On 3 February 2012 11:03, Ismael Núñez-Riboni <[hidden email]> wrote: >> It seems that if you use "size" without the parenthesis it interpretes the >> argument as a string... > > This is true of *all* Octave functions. > >     foo a b c d; > > is *exactly the same* as > >     foo("a", "b", "c", "d"); > > See here: > >     http://www.gnu.org/software/octave/doc/interpreter/Commands.html> > HTH, > - Jordi G. H. Is there any (help) command/function to show whether a name is a function or a command? Regards, ST -- _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 On 3 February 2012 22:06,  <[hidden email]> wrote: > On 02/04/2012 12:10 AM, Jordi Gutiérrez Hermoso wrote: >> On 3 February 2012 11:03, Ismael Núñez-Riboni <[hidden email]> wrote: >>> It seems that if you use "size" without the parenthesis it interpretes the >>> argument as a string... >> >> This is true of *all* Octave functions. >> >>     foo a b c d; >> >> is *exactly the same* as >> >>     foo("a", "b", "c", "d"); >> >> See here: >> >>     http://www.gnu.org/software/octave/doc/interpreter/Commands.html> > > Is there any (help) command/function to show whether a name is a > function or a command? All functions are also commands. If a function only accepts string arguments, it can be called with command syntax. But it's syntactical to do, say,     eig foo even though it will fail because the eig function doesn't know what to do with a string. - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: "size(foo)" vs "size foo" (octave-3.4.3)

 In reply to this post by lukshuntim On 4 February 2012 03:06,  <[hidden email]> wrote: > Is there any (help) command/function to show whether a name is a > function or a command? As Jordi as said, all functions are also commands. Still, about your question, the usage line of functions and commands help text will have the word "function" or "command" respectively (although the first line says functino for both) > help chdir `chdir' is a built-in function  -- Command:  cd dir  -- Command:  chdir dir > help plot `plot' is a function from the file /usr/local/share/octave/3.4.3-rc0/m/plot/plot.m  -- Function File:  plot (Y)  -- Function File:  plot (X, Y)  -- Function File:  plot (X, Y, PROPERTY, VALUE, ...)  -- Function File:  plot (X, Y, FMT)  -- Function File:  plot (H, ...)  -- Function File: H = plot (...) Carnë _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave