Can you help me please , to resolve this erreur in matlab

조회 수: 1 (최근 30일)
manel maatouk
manel maatouk 2018년 5월 18일
댓글: Walter Roberson 2018년 5월 20일
I want to browse a 4D matrix and I got this error message:
Undefined function '_colonobj' for input arguments of type 'double' and attributes 'full 4d real'.
  댓글 수: 5
manel maatouk
manel maatouk 2018년 5월 20일
편집: Jan 2018년 5월 20일
for ik=1:10 % ik longueur masque
for tt=1:21 % tt le num du theta
t=ttabTheta(tt); % t l'angle theta
for i=1:M
for j=1:N
if(radon_cartesien(ik,tt,i,j)==TabPik_Matrice(ik,tt))
resultatprog(s,1)=i;
resultatprog(s,2)=j;
end
end
end
end
end
[EDITED, Jan, code formatted]
Jan
Jan 2018년 5월 20일
The most important part is not posted: How is M defined?
You overwrite resultatprog(s,1) in each iteration of the 2 inner loops, when the condition is met. Is this really useful?

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

답변 (1개)

Jan
Jan 2018년 5월 19일
편집: Jan 2018년 5월 20일
The error message means, that in your code
for i=1:M
the variable M is a 'full 4d real' (although I do not know, what this means). Check how M is defined and adjust it to be a double. Maybe this is working already:
for i=1:double(M)
[EDITED] Walter has explained the error message: M is a 4D array, but the colon operator expects a scalar. Then I guess you want:
for i = 1:size(radon_cartesien, 3)
for j = 1:size(radon_cartesien, 4)
  댓글 수: 3
Jan
Jan 2018년 5월 20일
편집: Jan 2018년 5월 20일
@Walter: Thank you very much. I'm confused:
X = rand(2,3);
Y = rand(2,3,4,5);
1:X % Silently uses the 1st element only, no error
1:Y % Error:
Undefined function 'colon' for input arguments of type 'double'
and attributes 'full 4d real'.
After your explanation I understand the message. But if Matlab catches this problem for multi-dimensional arrays, I cannot understand, why there is no error for the 2D case. This:
for k = 1:size(X)
causes problems repeatedly and you find several concerning threads in this forum.
Walter Roberson
Walter Roberson 2018년 5월 20일
In the past I have seen it documented that the first value will be silently used (at least under some circumstances) but I do not see that documentation at present.

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by