Error in horzcat

1 次查看(过去 30 天)
Siddharth Mallya
Siddharth Mallya 2011-3-16
Hey ! I am trying to make a template of my braille character set and I keep getting the following error. I used the same code for OCR and it works perfectly. What do I do ?
I am attaching the code herewith,
%Letter
A=imread('CharacterSet\a.bmp');B=imread('CharacterSet\b.bmp');
C=imread('CharacterSet\c.bmp');D=imread('CharacterSet\d.bmp');
E=imread('CharacterSet\e.bmp');F=imread('CharacterSet\f.bmp');
G=imread('CharacterSet\g.bmp');H=imread('CharacterSet\h.bmp');
I=imread('CharacterSet\i.bmp');J=imread('CharacterSet\j.bmp');
K=imread('CharacterSet\k.bmp');L=imread('CharacterSet\l.bmp');
M=imread('CharacterSet\m.bmp');N=imread('CharacterSet\n.bmp');
O=imread('CharacterSet\o.bmp');P=imread('CharacterSet\p.bmp');
Q=imread('CharacterSet\q.bmp');R=imread('CharacterSet\r.bmp');
S=imread('CharacterSet\s.bmp');T=imread('CharacterSet\t.bmp');
U=imread('CharacterSet\u.bmp');V=imread('CharacterSet\v.bmp');
W=imread('CharacterSet\w.bmp');X=imread('CharacterSet\x.bmp');
Y=imread('CharacterSet\y.bmp');Z=imread('CharacterSet\z.bmp');
%Number
one=imread('CharacterSet\1.bmp'); two=imread('CharacterSet\2.bmp');
three=imread('CharacterSet\3.bmp');four=imread('CharacterSet\4.bmp');
five=imread('CharacterSet\5.bmp'); six=imread('CharacterSet\6.bmp');
seven=imread('CharacterSet\7.bmp');eight=imread('CharacterSet\8.bmp');
nine=imread('CharacterSet\9.bmp'); zero=imread('CharacterSet\0.bmp');
letter=[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z];
number=[one two three four five six seven eight nine zero];
character=[letter number];
templates=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]);
save ('templates','templates')
clear all
What is the problem ? =O

采纳的回答

Siddharth Mallya
Siddharth Mallya 2011-3-16
Got the answer. The character set my mates gave me were 3D and I am using an 2D matrix

更多回答(1 个)

Matt Fig
Matt Fig 2011-3-16
It would really help if you indicated which line errors, as I am sure you could guess if you put yourself in our shoes - but anyway...
If the error is on the line which assigns 'letter', then at least one of your CharacterSet images is not the same size as the others.
If the error is on the line which assigns 'number', then at least one of your CharacterSet images is not the same size as the others.
If the error is on the line which assigns 'character', then perhaps the 'letter' and 'number' variables aren't the same size.
.
.
By the way, you could do something much easier, like this:
T = char([97:122 48:57]);
templates = cell(1,length(T));
for ii = 1:length(T)
templates{ii} = imread(['CharacterSet\',T(ii),'.bmp']);
end
  7 个评论
Matt Fig
Matt Fig 2011-3-16
You are missing a ]. You have:
'[CharacterSet\',T(ii)
but you should have:
['CharacterSet\',T(ii),'.bmp']
Siddharth Mallya
Siddharth Mallya 2011-3-17
Ya .. No. I made a mistake while typing it here. The error I get is this exactly,
Error using ==> imwrite at 394
Cannot open $#^#$% file for writing
You may not have write permission

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by