I am getting an error "Cell contents reference from a non-cell array object"

1 view (last 30 days)
Kindly help me. Thanks in advance
Error in MCI (line 3) MVF_row = MVF{1};

Answers (3)

dpb on 9 Jul 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...)
Guillaume on 10 Jul 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.

Sign in to comment.

Guillaume on 9 Jul 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.

Image Analyst
Image Analyst on 10 Jul 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);
  1 Comment
jeffin on 10 Jul 2015
Sir, i used the steps
motionVect = vectors;
aaa = v1*v2
blk1 = motionVect(1,:)
B2 = reshape(blk1,[aaa/v1,aaa/v2])
MVF_blka = B2';
MVF = MVF_blka;
% MVFc = MVF_blka
blk2 = motionVect(2,:);
C2 = reshape(blk2,[aaa/v1,aaa/v2]);
MVF_blkb= C2';
MVF(:,:,2) = MVF_blkb
in my code below to reshape my matrix in the following form:ie,
motionVect =size(2 X 5N). // orginal size (step)
motionVect(1)= (1 X 5N) and motionVect(2)=1 X 5N // Intermediate step
MVF(1) = [1 ... N; N+1 ... 2N; 2N+1 ... 3N; 3N+1 ... 4N; 4N+1 ... 5N] // expected reshape ------------------(1)
MVF(2) = [1 ... N; N+1 ... 2N; 2N+1 ... 3N; 3N+1 ... 4N; 4N+1 ... 5N] // expected reshape
which i achieved using the above code.
Then in my code i called the next function MCI which is as follows:
function im_interp = MCI(im_prev_pad,im_next_pad,MVF,params)
MVF_row = MVF{1};
MVF_col = MVF{2};
im_rows = params.im_rows;
im_cols = params.im_cols;
[block_rows,block_cols] = size(MVF{1});
MVF_right{1} = -MVF{1};
MVF_right{2} = -MVF{2} ...
There are so many places in this function i use MVF{}. changing MVF{} to MVF() is causing me trouble/error in other functions. Therefore i felt that it is good to initialize the first MVF(1) and MVF(2) ie eqn(1) in the form of cell array.
Kindly help me. I am finding it difficult because i'am new to cell array concept. Thanks in advance.

Sign in to comment.


Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!