필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Digital Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by