Matrix Transfer of elements

I had asked similar to this before but had not given enough details. So will try again. I am trying to determine the lowest potential path between 2 points search start and search goal. My path matrix is a 60X2 called path and my source matrix from which I derive my lowest potential cell is 3x3. Once I derive the lowest potential cell in the 3X3 matrix sample8, I transfer the index of this to path. I tried the foll code but get error: :"In an assignment A(:) = B, the number of elements in A and B must be the same." Did some checking and believe this is caused by the line - path(i)=SearchStart;(SearchStart=[3,7] declared earlier in my code.)Thanks for any help provided.
i=1;
path = inf(60,2);
path(i)=SearchStart;
sample8=inf(3,3);

답변 (1개)

James Tursa
James Tursa 2015년 12월 2일

0 개 추천

Did you mean to assign the entire row? E.g., this?
path(i,:)=SearchStart;
Just guessing here since SearchStart is a 1x2 matrix.

댓글 수: 1

Ken
Ken 2015년 12월 2일
Yes. The x,y coordinates of successive points with the least potential to be transferred from sample8 to path i.e. the first point is SearchStart which has coordinates [3,7], this is transferred to sample8; then the next min point is calculated in sample8 and then put in path and so on.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

질문:

Ken
2015년 12월 2일

댓글:

Ken
2015년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by