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

1 view (last 30 days)
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 Comments
Stephen23
Stephen23 on 6 May 2017
Edited: Stephen23 on 6 May 2017
"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 on 6 May 2017
I want to use it as my testing data in the machine learning multiclass SVM. How am I supposed to do them so??

Sign in to comment.

Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!