unable to perform assignment because the size of the left side
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Jon
le 12 Oct 2023
Modifié(e) : Jon
le 12 Oct 2023
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.
Réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!