Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

1 view (last 30 days)
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);

Answers (1)

Geoff Hayes
Geoff Hayes on 10 Jun 2020
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.

Categories

Find more on Fuzzy Logic Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!