[Top][All Lists]

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

Re: Double problem in Matlab's magic.m

From: Quentin Spencer
Subject: Re: Double problem in Matlab's magic.m
Date: Thu, 08 May 2003 20:53:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030430 Debian/1.3-5

Henry F. Mollet wrote:

MATLAB's magic function is given below. A friend sent it to me as text in an
email. I used TextEdit on iMac to create magic.m. Due to unfortunate line
termination problem on Mac ( '\r' instead of '\n') the program won't run. I
corrected this problem based on earlier help on this list. It still does not
run because of undefined 'double' in n = floor(real(double(n(1))));
What's the problem?

It appears that the MATLAB and Octave versions of "double" do different things, partly because MATLAB allows for non-double data types which aren't (yet) supported in Octave. This function should run fine if you just removed the call do double and did

n = floor(real(n(1)));

That said, you can solve all of your problems by using the version of magic.m that is included in Octave-Forge (

Quentin Spencer

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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