How do i output character string on my code?
Mostrar comentarios más antiguos
So i'm working on project that outputs chess moves by using image processing to detect differences in the picture then my program out put chess move. Thanks to help Jan Simon one of the guys on MATLab central i sucessfully am able to ouput the correct chess moves. But i have one problem that might be easy to answer. When i run the program i am given two chess cell A=C6 A=E4. Which is correct but i want I want MATLab to output A = C6E4, instead of two different equations. I guess that is a string, please help.
My code
q3=imread('image3.jpg');
q4=imread('image4.jpg');
gray3 = imabsdiff(q3,q4);
RowName = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'};
ColName = {'1', '2', '3', '4', '5', '6', '7', '8'};
RowPos = 5:120:955;
ColPos = 160:120:1114;
A = [];
for row = 1:8
start_row = RowPos(row);
for col = 1:8
start_col = ColPos(col);
crop = gray3(start_row+33:start_row+98, ...
start_col+33:start_col+98, :);
b = find(crop >180); % *Not* the whole gray5 array!
% figure,imshow(crop)
% if ~isempty(b) % Better:
if any(crop(:) > 180)
A = [RowName{row}, ColName{col}]
end
end
end
Output--------------------------------------------
A =
C6
A =
E4
I want A= C6E4
thank you
Respuestas (1)
Walter Roberson
el 11 de Mzo. de 2011
In your loop,
A = [A RowName{row} ColName{col}];
Categorías
Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!