octave-maintainers
[Top][All Lists]
Advanced

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

Assignment through repeated indexing on LHS


From: Philip Nienhuis
Subject: Assignment through repeated indexing on LHS
Date: Thu, 19 Oct 2017 04:31:03 -0700 (MST)

(Couldn't find it in the manual or on the web)
I wonder if the following is a legal construct:

cell_array(:, 3:5)(index-vector) = some_value

or with a real example (invoking the testc cell array in  attached testc.mat
<http://octave.1599824.n4.nabble.com/file/t131602/testc.mat>  ) I tried:

load testc.mat
idx = find (cellfun (@isempty, testc(:, 3:8)));
testc(:, 3:8)(idx) = NaN

...yielding the following somewhat incomprehensible (to me) error message:
error: () must be followed by . or close the index chain

Am I correct to conclude that repeated indexing on the LHS of an expression
is illegal, or at least unsupported?
In that case I think the error message could be more clear, like explicitly
mentioning that repeated indexing on LHS is not permitted.

Typing:
testc(:, 3:8)(idx)
works fine of course as it is essentially a RHS expression.

Thanks,

Philip



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-Maintainers-f1638794.html



reply via email to

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