I am getting an error "Cell contents reference from a non-cell array object"
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Kindly help me. Thanks in advance
Error in MCI (line 3) MVF_row = MVF{1};
0 commentaires
Réponses (3)
dpb
le 9 Juil 2015
The short answer is don't use the curly braces around the '1' but what is MVF intended to be? The LHS variable name makes it look like you're intending more than a single element but we can't tell from the tiny code snippet with no context you've posted. If it is an array and you do want the first row, that would be MVF(1,:) but it would seem that a general expression would be more likely desired but at this point there's no klew as to what that might be (or even if am on right track or not...)
2 commentaires
Guillaume
le 10 Juil 2015
Well, if you want MVF to be a cell array, create it as such.
Until you explain what you're trying to do we can't help you do it right.
Guillaume
le 9 Juil 2015
Well, the error is fairly clear, you're trying to access a cell of a cell array but MVF is not a cell array.
Possibly, you meant:
MVF_row = MVF(1);
Or possibly, you meant something else entirely.
0 commentaires
Image Analyst
le 10 Juil 2015
It looks like MVF is a 3-dimensional array. Is it a color image? So you will never use braces with it. See the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F You say you want it to be a cell array. Why? For what purpose? And even if you did want that, that is not how you created it. You created it as a standard numerical 3D array when you did this:
MVF = MVF_blka;
MVF(:,:,2) = MVF_blkb;
So you have a 3D array with two planes or slices. It is not a cell array. So when you do this
MVF_row = MVF{1};
you're trying to get the first cell of a cell array. But it's not a cell array. You call it MVF_row like you're trying to get 1 row. Well 1 row will have two vectors in it - one from the top plane and one from the bottom plane. I'm not really sure what you're after here. You can get each plane like this:
MVF_plane1 = MVF(:,:,1);
MVF_plane2 = MVF(:,:,2);
Now if you wanted, say, row #42 from plane #1, you'd do this:
MVF_row = MVF_plane1(42,:);
If you wanted, say, column #13 from plane #2, you'd do this:
MVF_col = MVF_plane2(:, 13);
Voir également
Catégories
En savoir plus sur Computer Vision with Simulink dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!