help-octave
[Top][All Lists]
Advanced

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

Re: multi-line string in octave, Matlab code does not run in octave


From: fgnievinski
Subject: Re: multi-line string in octave, Matlab code does not run in octave
Date: Thu, 9 Jul 2015 13:20:39 -0700 (PDT)

On Thu, Jul 9, 2015 at 4:56 PM, NJank [via Octave] <
address@hidden> wrote:

> On Thu, Jul 9, 2015 at 3:57 PM, Nasser M. Abbasi <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4671530&i=0>> wrote:
>
>> On 7/9/2015 12:57 PM, Nasser M. Abbasi wrote:
>>
>>> I am trying to run some code I wrote in Matlab under Octave. This code
>>> runs ok in Matlab:
>>>
>>> ---------------------
>>> myString=['\n'...
>>> '\\section{short summary table}\n'];
>>> ----------------------
>>>
>>> But Octave gives syntax error
>>>
>>> -----------------------
>>>
>>>> octave
>>>>
>>> GNU Octave, version 3.8.1
>>>
>>> octave:1> t.m
>>> parse error near line 2 of file /home/me/data/t.m
>>>
>>>     syntax error
>>>
>>>> '\\section{short summary table}\n'];
>>>>>>
>>>>>        ^
>>> --------------------
>>>
>>> and
>>> -------------------------
>>>
>>>> cat t.m
>>>>
>>> myString=['\n'...
>>> '\\section{short summary table}\n'];
>>> ---------------------
>>>
>>> Does not octave support long string continuation using ... as
>>> with Matlab? and if so, what would the syntax be?
>>>
>>>
>> Ok, I've resolved this. Octave wanted a "," between the lines,
>> while Matlab does not. This works in Matlab:
>>
>> myString=['a'...
>>           'b'];
>>
>> But not in Octave. So changed it to add a comma as in:
>>
>> myString=['a',...
>>           'b'];
>>
>> And now it works in both Matlab and Octave.
>> Case closed.
>>
>>
>
> just verifying, ML 2015a doesn't require either the comma or whitespace
> character for that command. Octave 4.0.0 does.
>
> I would have thought without whitespace it would make a'b (same as if it
> was a single line without space between the two), but it does not.
>
> Thanks for checking.
(And sorry for top-posting previously.)
Ideally you wouldn't need to change the code
to make it compatible across M. and O.
-F.




--
View this message in context: 
http://octave.1599824.n4.nabble.com/multi-line-string-in-octave-Matlab-code-does-not-run-in-octave-tp4671526p4671531.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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