unable to perform assignment because the size of the left side

조회 수: 1 (최근 30일)
David
David 2023년 10월 12일
편집: Jon 2023년 10월 12일
can someone fix my error?
"Unable to perform assignment because the size of the left side is 1-by-3855 and the size of
the right side is 3616-by-1."
function [Output,kelas] = EkstraksiCurvature(folder, baseFileName, delta, kelas)
% fungsi ini digunakan untuk melakukan ekstraksi curvature
% objek dalam sebuah gamabr dengan solid background
fullFileName = dir(fullfile(folder, baseFileName));
JumFile=size(fullFileName,1);
for N=1:JumFile
citra = imread(fullfile(folder, fullFileName(N).name));
%PREPROCESSING
Tepi = prepross(citra);
x = Tepi(:,1);
y = Tepi(:,2);
%DIFFERENTIAL
[dx1,dx2] = differential(x,delta);
[dy1,dy2] = differential(y,delta);
Turunan = [dx1, dy1, dx2, dy2];
%EKSTRKASICURVATURE
k = curvature(Turunan);
Output(N,:)=k;
Kelas(N,1) = kelas;
end
end
  댓글 수: 3
David
David 2023년 10월 12일
I think I can figure it out what I had to do with this. Thx for your answer Dyuman. Really appriciete.
Jon
Jon 2023년 10월 12일
편집: Jon 2023년 10월 12일
Sound's like you were able to solve your problem, but in case you weren't aware of it MATLAB provides very nice debugging tools to let you step through your code and examine variables at specific points in the execution, https://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html
If you don't already do so, I suggest that whenever you run into these kinds of errors, you set a breakpoint just before the point where the error occurs (the error message shows the line where the error occurs, and you can click on the error message to jump to that point in your code). Then examine the variables, for example hover over them with the mouse, or look at the workspace variables in the workspace browser: https://www.mathworks.com/help/matlab/ref/workspacebrowser.html
In particular for an error message like yours you can check the array dimensions and make sure they make sense, and are what you expected.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by