Error: Functions cannot be indexed using {} or . indexing.
Show older comments
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 Comments
Alex Mcaulley
on 21 Jan 2020
Please, can you share the code and the full error text?
Guillaume
on 21 Jan 2020
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
on 21 Jan 2020
Guillaume
on 21 Jan 2020
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
on 21 Jan 2020
Guillaume
on 21 Jan 2020
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.
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!