필터 지우기
필터 지우기

How to create a .mat file

조회 수: 1 (최근 30일)
ravi
ravi 2014년 2월 3일
댓글: Walter Roberson 2014년 2월 4일
I am trying to create NewTemplates.mat file
I got an error as
*Error using horcat
Dimensions of matrices being concatenated are not consistent.
Error in
letter=[A Afill B Bfill C D Dfill E F G H I J K L M...*
code I used to create .mat file is
%CREATE TEMPLATES
%Letter
A=imread('A.bmp');B=imread('B.bmp');
C=imread('C.bmp');D=imread('D.bmp');
E=imread('E.bmp');F=imread('F.bmp');
G=imread('G.bmp');H=imread('H.bmp');
I=imread('I.bmp');J=imread('J.bmp');
K=imread('K.bmp');L=imread('L.bmp');
M=imread('M.bmp');N=imread('N.bmp');
O=imread('O.bmp');P=imread('P.bmp');
Q=imread('Q.bmp');R=imread('R.bmp');
S=imread('S.bmp');T=imread('T.bmp');
U=imread('U.bmp');V=imread('V.bmp');
W=imread('W.bmp');X=imread('X.bmp');
Y=imread('Y.bmp');Z=imread('Z.bmp');
Afill=imread('fillA.bmp');
Bfill=imread('fillB.bmp');
Dfill=imread('fillD.bmp');
Ofill=imread('fillO.bmp');
Pfill=imread('fillP.bmp');
Qfill=imread('fillQ.bmp');
Rfill=imread('fillR.bmp');
M1=imread('M2.jpg');
%Number
one=imread('1.bmp'); two=imread('2.bmp');
three=imread('3.bmp');four=imread('4.bmp');
five=imread('5.bmp'); six=imread('6.bmp');
seven=imread('7.bmp');eight=imread('8.bmp');
nine=imread('9.bmp'); zero=imread('0.bmp');
zerofill=imread('fill0.bmp');
fourfill=imread('fill4.bmp');
sixfill=imread('fill6.bmp');
sixfill2=imread('fill6_2.bmp');
eightfill=imread('fill8.bmp');
ninefill=imread('fill9.bmp');
ninefill2=imread('fill9_2.bmp');
fillone=imread('1fill.jpg');
filltwo=imread('2fill.jpg');
fillfour=imread('4fill.jpg');
%*-*-*-*-*-*-*-*-*-*-*-
letter=[A Afill B Bfill C D Dfill E F G H I J K L M...
N O Ofill P Pfill Q Qfill R Rfill S T U V W X Y Z M1];
number=[one two three four fourfill five...
six sixfill sixfill2 seven eight eightfill nine ninefill ninefill2 zero zerofill fillone
filltwo fillfour];
character=[letter number];
NewTemplates=mat2cell(character,42,[24 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24 ... 24 24 24 24 24 24 24]);
save ('NewTemplates','NewTemplates')
clear all

채택된 답변

Image Analyst
Image Analyst 2014년 2월 3일
Well, since it says their sizes don't match for stitching together horizontally, what are the numbers of rows for all these: A Afill B Bfill C D Dfill E F G H I J K L M...
  댓글 수: 2
ravi
ravi 2014년 2월 4일
I am using same dimension (24x42) for all the images A Afill B Bfill C D Dfill E F G H I J K L M... but the same error is occurring at that time also.
Walter Roberson
Walter Roberson 2014년 2월 4일
I speculate that some of them are RGB (3 dimensional matrices) and some of them are not. You need to look at size() of each of them.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by