|
From: | Philip Nienhuis |
Subject: | re: arrayfun on quaternion arrays |
Date: | Sat, 6 Jun 2020 23:10:03 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0 |
qqq = [quaternion(1,0,0,0); quaternion(1,0,0,0)]; whos % Attr Name Size Bytes Class % ==== ==== ==== ===== ===== % qqq 2x1 64 quaternion arrayfun(@(x)1, qqq) % ans = 1 arrayfun(@(x)abs(x), qqq) % error: arrayfun: all values must be scalars when UniformOutput = true Is there a way to avoid writing loops ?
>> arrayfun (@(x) abs(x), qqq, "uni", 0) ans = { [1,1] = 1 1 } ## (some people prefer '"UniformOutput", false') Is this the result you want? Philip
[Prev in Thread] | Current Thread | [Next in Thread] |