How to create a .mat file
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
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 Center 和 File Exchange 中查找有关 Behavior and Psychophysics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!