フィルターのクリア

How to find the distance between vectors whose coordinates are stored in different arrays.

1 回表示 (過去 30 日間)
MatlabFan
MatlabFan 2013 年 3 月 11 日
Hi,
I get the error:??? Cell contents assignment to a non-cell array object. at this line in my code:
for k=1:N
A{k}=zeros(length(m),2);
end
That's my first problem. Assuming that I figure out how to solve my first problem, I have another problem: once I have stored values in A{N}, I would like to compute
A{1}(1,:)-A{2}(1,:), A{1}(2,:)-A{2}(2,:), A{1}(3,:)-A{2}(3,:), ..., A{1}(n,:)-A{2}(n,:)
A{2}(1,:)-A{3}(1,:), A{2}(2,:)-A{3}(2,:), A{2}(3,:)-A{3}(3,:), ... , A{2}(n,:)-A{3}(n,:)
A{3}(1,:)-A{4}(1,:), A{3}(2,:)-A{4}(2,:), A{3}(3,:)-A{4}(3,:), ... , A{3}(n,:)-A{4}(n,:)
.
.
.
A{N-1}(1,:)-A{N}(1,:), A{N-1}(2,:)-A{N}(2,:), A{N-1}(3,:)-A{N}(3,:),..., A{N-1}(n,:)-A{N}(n,:)
and store these values into an n X N matrix.
I know I'm gonna find some help here, I always do.
Please help me solve my two problems.
Thanks.
  1 件のコメント
Matt J
Matt J 2013 年 3 月 11 日
Your example doesn't lead to an n X N matrix. Each A{i}(j,:) is a 1x2 vector, so this leads to a N-1 x 2*n matrix.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2013 年 3 月 11 日
編集済み: Matt J 2013 年 3 月 11 日
Your first problem.
A=cell(N,1);
for k=1:N
A{k}=zeros(length(m),2);
end
  5 件のコメント
Matt J
Matt J 2013 年 3 月 11 日
Errors like these are a job for the debugger. Set a breakpoint at line 55 in ImagExperiment and rerun your code. When the code halts at line 55, run
z=cellfun(@(c) size(c), A,'uni',0); z{:}
at the K>> prompt and show us the output.
MatlabFan
MatlabFan 2013 年 3 月 11 日
Hi Matt, I found a way around this. And yes, I thank you for your great help. Now, I am experiencing other issues with my code.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDigital Filtering についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by