octave-patch-tracker
[Top][All Lists]
Advanced

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

[Octave-patch-tracker] [patch #8119] Allow variable tolerance and improv


From: Dan Sebald
Subject: [Octave-patch-tracker] [patch #8119] Allow variable tolerance and improve error messages for assert.m script
Date: Wed, 07 Aug 2013 08:07:47 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15

Follow-up Comment #14, patch #8119 (project octave):

Apparently that isn't a bug.  The three output argument find is:

[i, j, v] = find (A)

and returns values in the third column.  I would think that the output
arguments would be the various dimensions and if there were one greater output
than dimensions that would be for the values.

No matter, just use ind2sub with an extra function call:


oarg = sprintf ("i%d ", 1:ndims (A));
eval (cstrcat ("[", oarg, "] = ind2sub (size (A), find (A != B));"));
eval (cstrcat ("idx = [", oarg, "];"));
for i = 1:length (i1)
  loc = sprintf("%d,", idx (i,:)) (1:end-1);
end


which works correctly:


>> oarg = sprintf ("i%d ", 1:ndims (A));
>> eval (cstrcat ("[", oarg, "] = ind2sub (size (A), find (A != B));"));
>> eval (cstrcat ("idx = [", oarg, "];"));
>> for i = 1:length (i1)
  loc = sprintf("%d,", idx (i,:)) (1:end-1)
end
loc = 1,1,1
loc = 2,2,2


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8119>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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