How to save a vector into cell array?

Dear all,
I have this code:
imdl = mk_common_model('d2d1c',16);
img_1 = mk_image(imdl);
figure
show_fem(img_1);
img_2 = img_1;
c=cell(2,[])
v = 0:0.1:1
idx = 1;
for j = 0:0.5:1
v(idx) = j;
['x-' num2str(j) '.^2+ (y- 0.5) .^2<0.1^2, ''x,' 'y,' 'z'];
select_fcn = inline('(x-j).^2+(y-0.5).^2<0.1^2','x','y','z');
img_2.elem_data = 1 + elem_select(img_2.fwd_model, select_fcn);
idx = idx + 1;
figure
show_fem(img_2);
vh = fwd_solve(img_1);
vi = fwd_solve(img_2);
img_3 = inv_solve (imdl,vh,vi);
figure
show_fem(img_3);
k = idx;
c{1,k} = fwd_solve
c{2,k} = j
end
I want to insert a vector of values of fwd_solve into cell array element, but comand window reports this:
Warning: Calling FWD_SOLVE with two arguments is deprecated and will cause an error in a future version. First argument ignored.
> In fwd_solve at 36
In matlab at 50
Error using fwd_solve (line 43)
Not enough input arguments.
Error in matlab (line 50)
c{1,k} = fwd_solve
Does anyone have any idea?
Thank you for your answers.

1 Comment

This error has nothing to do with storing anything into a cell array; it's a syntax problem with the call to fwd_solve itself.
The offending line is given as
Error in matlab (line 50) c{1,k} = fwd_solve
which, indeed, has zero arguments for a function that obviously must have something to work with. Unfortunately, a search of the TMW returns no hits for fwd_solve returns zero hits other than this and some previous other questions you've posted so I've no idea what the function must do but it appears you've used it successfully before and there are a couple of earlier calls here that seem to have not error'ed.
So, what you want on the RHS is either the output you got from one of those earlier calls or if it's something else you're trying to save, then call it again with that appropriate input and save the result of that call.
You make a cell quantity by bracketing the RHS with the curly braces.

Sign in to comment.

Answers (1)

dpb
dpb on 29 Jan 2015
Edited: dpb on 30 Jan 2015
This error has nothing to do with storing anything into a cell array; it's a syntax problem with the call to fwd_solve itself.
The offending line is given as
Error in matlab (line 50) c{1,k} = fwd_solve
which, indeed, has zero arguments for a function that obviously must have something to work with. Unfortunately, a search of the TMW for fwd_solve returns zero hits other than this and some previous other questions you've posted so I've no idea what the function must do but it appears you've used it successfully before and there are a couple of earlier calls here that seem to have not error'ed.
So, what you want on the RHS is either the output you got from one of those earlier calls or if it's something else you're trying to save, then call it again with that appropriate input and save the result of that call.
You make a cell quantity by bracketing the RHS with the curly braces so something like
c{1,k} = {fwd_solve(desiredInput)};

4 Comments

Thank you for your answer.
I tried to input like desiredInput img_2. It works, but comand window reports this: (for example) c =
[] {1x1 cell} {1x1 cell} {1x1 cell}
[] [ 0] [ 0.5000] [ 1]
no values, just text 1x1 cell.
It should be a vector, so I don´t know, if it´s right. What do you think?
Well, I think I don't know... :) I have no information from which to work other than the code above as there's no online doc's for any of your functions to refer to.
I don't see any reference to desiredInput img_2 above so no idea what it is other than maybe(?) an image array and the phrase " tried to input like desiredInput img_2" is nebulous at best as to what that really means but presuming that means the result is from
c=fwd_solve(desiredInput img_2)
then I'd have to assume it is, in fact, "right" given whatever it is that the funtion is supposed to do with that as an input.
The display is simply the way Matlab displays cell arrays when there's more than a single element in a cell or the content of a cell is another cell. c(1,2) may well hold a vector inside the cell that is there; you'll have to dereference it to tell what it actually is.
c{1,2} % returns what????
Looks like you need to understand more about what the toolset is doing; where did these functions come from if you didn't write them? The author/organization is probably where to go for primary support.
Ok. These functions come from EIDORS (Electrical Impedance Tomography and Diffuse Optical Tomography Reconstruction Software), which is software Matlab. Thank you for your effort.
OK, never heard of it, but looks like
might be of some help in determining "who's who in the zoo"...

Sign in to comment.

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Asked:

on 29 Jan 2015

Edited:

on 1 Feb 2015

Community Treasure Hunt

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

Start Hunting!