How to subtract contents of cells in cell array?
古いコメントを表示
Hi,
I am trying to get the euclidean distances from xyz coordinates (columns 1-3 of baskets_xyz cells) to a reference point (column 10 in each cell in baskets_xyz). I want to perform the euclidean distance calculation to each cell in baskets_xyz so that I receive a single column for each cell as an output. I have tried the following code:
H = @(x) sqrt(((x(:,1)-x(:,10)).^2) ...
+ ((x(:,2)-x(:,10)).^2) ...
+ ((x(:,3)-x(:,10)).^2));
baskets_xyz_h_ref = cellfun(H,baskets_xyz,'uniform',false);
When I run this code I get the error:
Undefined function 'minus' for input arguments of type 'cell'.
Error in Glitch_comparison_distances (line 96)
H = @(x) sqrt(((x(:,1)-x(:,10)).^2) ...
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Cell Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!