Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
1 次查看(过去 30 天)
显示 更早的评论
Hi, i am working one code to make a gui. After i save fuzzy logic with spec .fis and then I make a gui and save this gui with name linefolo.fig. Fact, i save .fis and .fig in same file. And then after I try to callback push button, error.
My code :
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a = readfis('linefol.fis');
out = evalfis([handles.kiri handles.kanan handles.lebarjalur],a);
set =([handles.edit4 handles.edit5 handles.edit6],'string',out);
I keep getting an error (Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.) gives the error in the line
set = ([handles.edit4 handles.edit5 handles.edit6],'string'out);
0 个评论
回答(1 个)
Geoff Hayes
2020-6-10
nada - I think that you are trying to set the string property for each of the three edit fields to be the same value. Note that set is a function and so you are passing parameters into it and not assigning anything to it...so really all you should need to do is remove the = sign.
set([handles.edit4 handles.edit5 handles.edit6], 'string', out);
Note also the comma added after 'string'. While this code change will fix the error, a different error will probably be thrown because of out which from evalfis output tells us that this (the out) will be an array of data. I don't have the Fuzzy Logic Toolbox so I don't know what this array will be though I suspect it won't be a string (cell) array. Is it numeric? Whatever it is, you will need to format it as a string so that you can write it your fields. You will also need to determine which array element should be "written" or "set" for each edit field.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Logic Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!