Error using horzcat Dimensions of matrices being concatenated are not consistent.

1 次查看(过去 30 天)
Red = seg_img(:,:,1);
Green = seg_img(:,:,2);
Blue = seg_img(:,:,3);
[yRed, x] = imhist(Red,16);
[yGreen, y] = imhist(Green,16);
[yBlue, z] = imhist(Blue,16);
RedHist = [yRed,x];
GreenHist = [yGreen,y];
BlueHist = [yBlue,z];
figure
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
T = otsuthresh(yBlue);
BW = imbinarize(yBlue, T);
otsuRes = T;
CCV = getICCV(seg_img);
CCVres = CCV;
LBPresult = LBP(seg_img,1);
LBPres = LBPresult;
figure
imshow(LBPresult);
mapping=getmapping(8,'uint8');
[CLBP_SH,CLBP_MH]=clbp(seg_img,1,8,mapping,'h');
CLBPres = [CLBP_SH,CLBP_MH];
diseaseResults = [RedHist', GreenHist', BlueHist', otsuRes, CCVres', LBPres', CLBPres];
The error is in this line:
diseaseResults = [RedHist', GreenHist', BlueHist', otsuRes, CCVres', LBPres', CLBPres];
could anyone please help?
  4 个评论
Stephen23
Stephen23 2017-5-6
编辑:Stephen23 2017-5-6
"The size command didn't work because them all are in a variable in a mat file"
Well, by the time you use those variables in that last line (where the error occurs) they are certainly not in any mat file, so you can simply put the size commands to replace that line.
In any case, if the sizes that you have given are correct then there is noway that they could be concatenated together into one numeric array like that: their rows and columns are simply incompatible. What exactly do you intend to do with the variable diseaseResults? Depending on what you want to do with diseaseResults you might be able to use cell arrays.
Mayss Aliyeh
Mayss Aliyeh 2017-5-6
I want to use it as my testing data in the machine learning multiclass SVM. How am I supposed to do them so??

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by