How to save a vector into cell array?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
dpb
am 29 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 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.
Antworten (1)
dpb
am 29 Jan. 2015
Bearbeitet: dpb
am 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 Kommentare
dpb
am 30 Jan. 2015
OK, never heard of it, but looks like
might be of some help in determining "who's who in the zoo"...
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!