Strings in Octave and Matlab
Ben Abbott
bpabbott at mac.com
Tue Jan 6 16:59:07 CST 2009
It isn't that Ocave is more lax, it is that Octave is more functional.
For octave double quotes and single quotes can imply different things.
octave:6> some_string = "hello\nworld"
some_string = hello
world
octave:7> some_string = 'hello\nworld'
some_string = hello\nworld
Ben
On Jan 6, 2009, at 3:14 PM, James Sherman Jr. wrote:
> I believe this is just because octave is just more lax because it
> accepts both ' and " as delimeters for a string. I think they did
> this for those that are used to programming in C and are more
> familiar with using " instead of '.
>
> Just stick with the single apostrophe ( ' ) and you should be fine.
>
> I know there are other cases like this (using the ++ operator I
> think is one), but I don't know of any mode where you can force
> Matlab compatibility in Octave.
>
> On Tue, Jan 6, 2009 at 2:59 PM, Matthias Brennwald <matthias at brennwald.org
> > wrote:
> Dear all
>
> I am confused about the way strings are used in Octave and Matlab:
>
> 1. With Matlab 7.5.0.338 (R2007b)
> --------
> >> str = 'some string'
> str =
> some string
>
> >> str = "some string"
> ??? str = "some string"
> --------
>
> 2. With Octave 3.0.3
> --------
> octave-3.0.3:1> str = 'some string'
> str = some string
>
> octave-3.0.3:2> str = "some string"
> str = some string
> --------
>
> Is Octave just a bit more tolerant than Matlab about the way strings
> are made? Is there a way to force Octave to behave the same as Matlab
> (to force me to write code that works with Matlab, too)?
>
> Matthias
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
More information about the Help-octave
mailing list