Undefined function 'sum' for input arguments of type 'cell'.

2 visualizaciones (últimos 30 días)
Veronika
Veronika el 13 de Mzo. de 2017
Comentada: Walter Roberson el 14 de Mzo. de 2017
Dear all,
I have code for creating FEM model, but there is an error :
Undefined function 'sum' for input arguments of type 'cell'.
Error in mean (line 115)
y = sum(x, dim, flag)/size(x,dim);
Error in ng_mk_extruded_model>calc_centroid (line 415)
m = mean(points);
Error in ng_mk_extruded_model>parse_shape (line 231)
tank_shape.centroid = calc_centroid(points);
Error in ng_mk_extruded_model>mk_extruded_model (line 91)
[tank_height, tank_shape, tank_maxh, is2D] = parse_shape(shape);
Error in ng_mk_extruded_model (line 76)
fmdl = mk_extruded_model( shape, elec_pos, elec_shape, extra_ng_code );
Error in Newmodel (line 41)
fmdl = ng_mk_extruded_model(thorax_shape, elec_pos, elec_shape);
Error in DP_segment_final>Okoli_Callback (line 418)
[fmdl,img_okoli] = Newmodel(params,shape);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in DP_segment_final (line 44)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DP_segment_final('Okoli_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
I attach my codes and original image. Thank you for your answers.
  6 comentarios
Veronika
Veronika el 14 de Mzo. de 2017
Yes, I´m using EIDORS.
Walter Roberson
Walter Roberson el 14 de Mzo. de 2017
One of the first htings that DP_segment_final does is prompt for the location of eidors. However, it then ignores the answer, and instead has hard-coded a number of references to editors at one particular location in C:/ . That's a bit of a problem for non-PCs.

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 13 de Mzo. de 2017
I'd start with using the debugger. Type this in the command window:
dbstop if error
(Or use the corresponding menu element in the editor) and run your code again. Then Matlab stops at the error and you can check the types of the variables in the Workspace Browser or in the command window:
class(x)
class(dim)
class(flag)
Now search in the code, where the variable, which is a cell, has been defined. The error message is clear: sum() cannot operate on cells, therefore the command, which created this variable as a cell is the problem.
  2 comentarios
Veronika
Veronika el 13 de Mzo. de 2017
It doesn´t help, because these variables are in Matlab in .m file mean.m. So I think, that Command Window doesn´t help me...
Jan
Jan el 13 de Mzo. de 2017
Editada: Jan el 13 de Mzo. de 2017
@Veronika: Please, try it. The dbstop command triggers the debugger to stop Matlab, when the error occurres. Then you can inspect the current workspace. Of course this does not solve the problem, but it will help to recognize, what the problem is.
It would be easier, if you run this and post the reply of the shown command, than to let the readers download the files and do this on their computers. In addition you would learn how to use the debugger to examine the sources of errors.

Iniciar sesión para comentar.

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by