[Top][All Lists]

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

[Octave-bug-tracker] [bug #49072] assigning double arrays to cell arrays

From: anonymous
Subject: [Octave-bug-tracker] [bug #49072] assigning double arrays to cell arrays: matlab incompatibility?
Date: Mon, 19 Sep 2016 18:35:42 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0

Follow-up Comment #3, bug #49072 (project octave):

Yes, c(1,:)={rand(1,2)} works in matlab, and assigns a 1x2 double to each
individual cell.

Confusing about the assignment c(1,:) = rand(1,2) is that, by analogy to
assigning to a numerical array, an unsuspecting user might expect c(1,1) and
c(1,2) to contain a single double.

For that end you need c(1,:) = num2cell(rand(1,2)).

Maybe a warning would be nice to have, when assigning a double array to cell
of same size

warning: assigning array of double to cell of same size. Did you mean to use


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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