Error: Functions cannot be indexed using {} or . indexing.

I have this error when i try to execute some script on matlab
My problem is : i have is scrpit which works on matlab 2013 but when i try to use it on matlab 2016 i have this error :
Functions cannot be indexed using {} or . indexing , i d'ont know why!
Someone can tell why this occurs??
thanks.

7 个评论

Please, can you share the code and the full error text?
stephane teiguim's comment originally posted as an Answer moved here:
yes of course
function MBA_MainForm_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to MBA_MainForm (see VARARGIN)
if(isempty(varargin))
handles.MainCtrl = CMBAMainCtrl();
else
handles.MainCtrl = varargin{1};
end
% Choose default command line output for MBA_MainForm
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes MBA_MainForm wait for user response (see UIRESUME)
% uiwait(handles.figure1);
list = handles.MainCtrl.GetProjectList();
if(~isempty(list))
set(handles.PrList, 'String', list);
end
prj = handles.MainCtrl.LastProject;
if(~isempty(prj))
if(isempty(varargin))
close;
MBA_ModuleForm(handles.MainCtrl); // the error is on this line
else
set(handles.CfgName, 'String', prj.CfgName);
set(handles.WdPath, 'String', prj.FolderName,'HorizontalAlignment','left');
[a,b,c]=fileparts(prj.SwarFile);
set(handles.SwarFile, 'String', [b,c],'HorizontalAlignment','left');
[a,b,c]=fileparts(prj.YedarFile);
set(handles.YedarFile, 'String', [b,c],'HorizontalAlignment','left');
end
en
error text :
Error: Functions cannot be indexed using {} or . indexing.
Please, post the full text of the error message. Everything in red. In particular, we need to see the bit that tells us which line is actually throwing the error.
the full error is :
Error: Functions cannot be indexed using {} or . indexing.
Error in MBA_MainForm>MBA_MainForm_OpeningFcn (line 106)
MBA_ModuleForm(handles.MainCtrl);
Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in MBA_MainForm (line 71)
gui_mainfcn(gui_State, varargin{:});
Thanks. This is puzzling since the line that is causing the error cannot actually throw that error. I suspect that the error is actually inside the MBA_ModuleForm function which for some reason makes a call throwAsCaller so that the error appears on the calling line.
Can you share the code for MBA_ModuleForm?
Yes the error came from MBA_ModuleForm , on my first comment i posted a part of a code of MBA_ModuleForm be cause the script is too long, it take 639 line.
Do you always want that i share it there?
You've posted part of MBA_MainForm, but the error appears to come from MBA_ModuleForm.
But yes, it would be useful to have the full code. Attach the m file to the question.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by