Subscripted assignment dimension mismatch.
Mostrar comentarios más antiguos
good after noon everyone! please help me in this error i need to create a data base to 500 images all of dimension 100x100 and to compare it with another image of the same dimension when creating the database i use
for i=1:500
dataBase(i,:)=['Images/Database/' int2str(i) '.jpg '];
end
save Database
however the code only reads the first 9 images then display the following error * *
Subscripted assignment dimension mismatch.
Error in DB(line 3)
dataBase(i,:)=['Images/Database/' int2str(i) '.jpg '];* *
and the dataBase appears as 9x22 double i=10
please help me thanks
Respuesta aceptada
Más respuestas (2)
Since your strings have different lengths, you should hold them in a cell array,
for i=1:500
dataBase{i}=['Images/Database/' int2str(i) '.jpg '];
end
To hold them as a char array, you would have to pad the strings with spaces to make them of equal length. The char() command can do this, but it is questionable how essential this is for you.
4 comentarios
Matt J
el 18 de Abr. de 2015
Nour Mawla commented:
Mr. Matt J, thank you for your response however it didn't work the dataBase appeared as 1x500 cells and it gives an error when running the comparing function what i need is a dataBase 500x22 char Thanks
Image Analyst
el 18 de Abr. de 2015
Then see the second half of my reply.
Matt J
el 18 de Abr. de 2015
Once you have the cell array, you can convert as follows,
dataBase=char(dataBase)
Nour Mawla
el 18 de Abr. de 2015
Nour Mawla
el 18 de Abr. de 2015
0 votos
Categorías
Más información sobre Image Arithmetic 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!