how to remove this error?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Image Analyst
2016년 12월 10일
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);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!