Error: Unexpected MATLAB expression.

9 visualizzazioni (ultimi 30 giorni)
Putra
Putra il 27 Mar 2023
Commentato: Walter Roberson il 27 Mar 2023
Hello. This is my code and I keep getting the error "Unexpected MATLAB Expression", several times throughout but can't find the mistake.
Error in line 'Buka citra asli';
% --- Executes on button press in open.
function open_Callback(hObject, eventdata, handles)
% hObject handle to open (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[nama_file1, nama_path1]=uigetfile(...
{'*.bmp; *.jpg',' File Citra(*.bmp, *.jpg)';
'*.bmp','File Bitmap(*.bmp)';...
'*.jpg','File Jpeg(*.jpg)';...
'*.*', 'Semua File(*.*)'}...
'Buka citra asli';

Risposte (1)

Cris LaPierre
Cris LaPierre il 27 Mar 2023
Modificato: Cris LaPierre il 27 Mar 2023
You are missing your closing paretheses, as well as a comma to separate the final line from the cell array..
[nama_file1, nama_path1]=uigetfile(...
{'*.bmp; *.jpg',' File Citra(*.bmp, *.jpg)';
'*.bmp','File Bitmap(*.bmp)';...
'*.jpg','File Jpeg(*.jpg)';...
'*.*', 'Semua File(*.*)'},...
'Buka citra asli');
  2 Commenti
Putra
Putra il 27 Mar 2023
Sorry your answer still raises error of unexpected matlab expression
Walter Roberson
Walter Roberson il 27 Mar 2023
Cris's suggested code works fine on my system.
Notice that Cris made two changes:
  1. Add a comma after the 'Semua File(*.*)'} and before the ...
  2. add closing ')' after 'Buka citra asli'

Accedi per commentare.

Categorie

Scopri di più su Function Creation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by