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 个评论
Alex Mcaulley
2020-1-21
Please, can you share the code and the full error text?
Guillaume
2020-1-21
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.
stephane teiguim
2020-1-21
Guillaume
2020-1-21
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?
stephane teiguim
2020-1-21
Guillaume
2020-1-21
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!