필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Veronika
Veronika 2017년 3월 13일
댓글: Walter Roberson 2017년 3월 14일
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
Veronika
Veronika 2017년 3월 14일
Yes, I´m using EIDORS.
Walter Roberson
Walter Roberson 2017년 3월 14일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2017년 3월 13일
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
Veronika
Veronika 2017년 3월 13일
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 2017년 3월 13일
편집: Jan 2017년 3월 13일
@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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by