octave-maintainers
[Top][All Lists]
Advanced

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

Re: bin2dec behavior different from Matlab?


From: ahowe42
Subject: Re: bin2dec behavior different from Matlab?
Date: Thu, 22 Mar 2012 01:31:41 -0700 (PDT)

Miguel

Instead of having your students learn num2str, you could show them how
sprintf works.  Since this comes from C, it's widely applicable and gives
more control.  For the specific issue here, if x is a logical array, you can
do this:

xstr = sprintf("%d",x)

then bin2dec(xstr) is 5 as expected.

Andrew

--
View this message in context: 
http://octave.1599824.n4.nabble.com/bin2dec-behavior-different-from-Matlab-tp4477272p4494856.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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