how to remove this error?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
maida
el 10 de Dic. de 2016
Comentada: maida
el 10 de Dic. de 2016
1.i have 50 images
2.my code produces feature vector of size 512 by 512 of 50 images using a for loop
3. i am using reshape function to make matrix of 512 by 512 into 1 by 512*512=262144 vector. similarly for 50 images i need to do the same to get the final mat file of dimension 50 rows and 262144 columns.
4. whenever i try to save this vector. i always get this error
Subscripted assignment dimension mismatch.
Error in mathworks (line 19)
Result(i,:) = fv;
4. fv is producing a mat file containing 1 by 262144 feature vectors.As error occur during the first image(am using for loop to do the same process for all 50 images)
5. The code is attached please tell me the problem
0 comentarios
Respuesta aceptada
Image Analyst
el 10 de Dic. de 2016
You have this line:
fv= reshape(fv,i,[]);
This reshapes fv to have 1 row and 262144 rows when i=1, and 2 rows and 262144/2=131077 the second iteration when i=2. So now fv is not a vector anymore but a matrix of size 2 rows by 131077 columns. You can't stick a matrix into an array where you're specifically specifying that the data should go ONLY into columns like this:
Results(i,:) = fv;
If you want fv to be a row vector of 262144 columns, then you need to do this:
fv = reshape(fv, 1, 262144);
Más respuestas (0)
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!