Matlab compatibilty

Ben Abbott bpabbott at mac.com
Tue Sep 23 21:50:11 CDT 2008


On Sep 23, 2008, at 9:20 PM, Erich Ritz wrote:

> I tried searching to see if this issue was already posted; forgive  
> me if it is.
>
> Matlab allows:
>
> my_str = strcat([], 'a')
>
> and octave gives an error: error: strcat: all arguments must be  
> strings
>
> The rational for the above statement is:
>
> my_str = [];
> for ...
>    ...
>    my_str = strcat(my_str, 'some text');
> end
>
> The work around is to do:
> my_str = '';
> instead when initializing.
>
> Note also that octave allows
> my_str = [my_str 'some text'];
> in the above context, but [] behave differently than strcat().
>
> Erich

hmmm ... another example. Running Matlab ...

	>> strcat (33, 33)
	ans =
	!!
	
Even stranger, real numbers are round down (floor)

	>> strcat (33.7, 33)
	ans =
	!!

I guess all positive reals work going in, but return characters in all  
cases.

	>> strcat(-19,33)
	Warning: Out of range or non-integer values truncated during  
conversion to character.
	ans =
	 !

Even, out of range numbers give a warning, but no error.

This should be rather easy to fix. If no one gets to it, I'll take a  
look later tomorrow.

Ben



More information about the Bug-octave mailing list