我收到了这个不需要的解析错误
错误:文件:GUI.m行:284列:5。意外的MATLAB运算符。
但是,我看不到任何意外的操作员。任何人都能诊断出这个问题吗?
这是我的代码:
function varargout = GUI(varargin)
% GUI MATLAB code for GUI.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI.M with the given input arguments.
%
% GUI('Property','Value',...) creates a new GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before GUI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to GUI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help GUI
% Last Modified by GUIDE v2.5 24-May-2017 23:28:18
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_OpeningFcn, ...
'gui_OutputFcn', @GUI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
end
% End initialization code - DO NOT EDIT
% --- Executes just before GUI is made visible.
function GUI_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 GUI (see VARARGIN)
% Choose default command line output for GUI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = GUI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in START.
function START_Callback(hObject, eventdata, handles)
% hObject handle to START (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Cfilename;
global Cpathname;
global Tfilename;
global Tpathname;
fid = fopen('C:\Users\Vikcy\Desktop\Flight Images\Values.txt');
tline = fgetl(fid);
C = strsplit(tline,{',',' ','[',']'});
set(handles.fname,'String',C{1,2});
set(handles.shape,'String',C{1,3});
set(handles.shaColor,'String',C{1,4});
set(handles.char,'String',C{1,5});
set(handles.charCol,'String',C{1,6});
set(handles.GLat,'String',C{1,7});
set(handles.GLong,'String',C{1,8});
set(handles.Orient,'String',C{1,9});
Cpathname = 'C:\Users\Vikcy\Desktop\Flight Images\';
Cfilename = 'I.jpg'
Cvar=strcat(Cpathname,Cfilename);
CORI_IMG=imread(Cvar);
%axis(handles.axes1);
%imshow(CORI_IMG);
imshow(CORI_IMG,'Parent',handles.axes1)
Tpathname = 'C:\Users\Vikcy\Desktop\Flight Images\';
Tfilename = C{1,2};
Tvar=strcat(Tpathname,Tfilename);
TORI_IMG=imread(Tvar);
%axis(handles.axes2);
%imshow(TORI_IMG);
imshow(TORI_IMG,'Parent',handles.axes2)
X = strsplit(C{1,1},{'-','.'});
global I;
global J;
I = X{1};
J = X{2};
function fname_Callback(hObject, eventdata, handles)
% hObject handle to fname (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of fname as text
% str2double(get(hObject,'String')) returns contents of fname as a double
% --- Executes during object creation, after setting all properties.
function fname_CreateFcn(hObject, eventdata, handles)
% hObject handle to fname (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function shaColor_Callback(hObject, eventdata, handles)
% hObject handle to shaColor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of shaColor as text
% str2double(get(hObject,'String')) returns contents of shaColor as a double
% --- Executes during object creation, after setting all properties.
function shaColor_CreateFcn(hObject, eventdata, handles)
% hObject handle to shaColor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function char_Callback(hObject, eventdata, handles)
% hObject handle to char (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of char as text
% str2double(get(hObject,'String')) returns contents of char as a double
% --- Executes during object creation, after setting all properties.
function char_CreateFcn(hObject, eventdata, handles)
% hObject handle to char (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function charCol_Callback(hObject, eventdata, handles)
% hObject handle to charCol (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of charCol as text
% str2double(get(hObject,'String')) returns contents of charCol as a double
% --- Executes during object creation, after setting all properties.
function charCol_CreateFcn(hObject, eventdata, handles)
% hObject handle to charCol (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function GLat_Callback(hObject, eventdata, handles)
% hObject handle to GLat (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of GLat as text
% str2double(get(hObject,'String')) returns contents of GLat as a double
% --- Executes during object creation, after setting all properties.
function GLat_CreateFcn(hObject, eventdata, handles)
% hObject handle to GLat (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function GLong_Callback(hObject, eventdata, handles)
% hObject handle to GLong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of GLong as text
% str2double(get(hObject,'String')) returns contents of GLong as a double
% --- Executes during object creation, after setting all properties.
function GLong_CreateFcn(hObject, eventdata, handles)
% hObject handle to GLong (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
end
set(hObject,'BackgroundColor','white');
function shape_CreateFcn(hObject, eventdata, handles)
% hObject handle to shape (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Orient_Callback(hObject, eventdata, handles)
% hObject handle to Orient (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Orient as text
% str2double(get(hObject,'String')) returns contents of Orient as a double
function Orient_CreateFcn(hObject, eventdata, handles)
% hObject handle to Orient (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation, after setting all properties.
% --- 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)
% --- Executes on button press in CANCEL.
function CANCEL_Callback(hObject, eventdata, handles)
% hObject handle to CANCEL (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function gLat2_Callback(hObject, eventdata, handles)
% hObject handle to gLat2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of gLat2 as text
% str2double(get(hObject,'String')) returns contents of gLat2 as a double
% --- Executes during object creation, after setting all properties.
function gLat2_CreateFcn(hObject, eventdata, handles)
% hObject handle to gLat2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function gAlt_Callback(hObject, eventdata, handles)
% hObject handle to gAlt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of gAlt as text
% str2double(get(hObject,'String')) returns contents of gAlt as a double
% --- Executes during object creation, after setting all properties.
function gAlt_CreateFcn(hObject, eventdata, handles)
% hObject handle to gAlt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit12 as text
% str2double(get(hObject,'String')) returns contents of edit12 as a double
% --- Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function GBear_Callback(hObject, eventdata, handles)
% hObject handle to GBear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of GBear as text
% str2double(get(hObject,'String')) returns contents of GBear as a double
% --- Executes during object creation, after setting all properties.
function GBear_CreateFcn(hObject, eventdata, handles)
% hObject handle to GBear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in NEXT.
function NEXT_Callback(hObject, eventdata, handles)
% hObject handle to NEXT (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function shape_Callback(hObject, eventdata, handles)
% hObject handle to shape (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of shape as text
% str2double(get(hObject,'String')) returns contents of shape as a double
%fid = fopen('C:\Users\Vikcy\Desktop\Files\Values.txt');
%C = textscan(fid, '%s')
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in preTar.
function preTar_Callback(hObject, eventdata, handles)
% hObject handle to preTar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Tfilename;
global Tpathname;
global I;
global J;
J=int32(str2num(J));
J=J-1;
J=int2str(J);
Tfilename = strcat(I,'-',J,'.jpg');
fid = fopen('C:\Users\Vikcy\Desktop\Flight Images\Values.txt');
for i = 1:count
tline = fgetl(fid);
end
C = strsplit(tline,{',',' ','[',']'});
set(handles.fname,'String',C{1,2});
set(handles.shape,'String',C{1,3});
set(handles.shaColor,'String',C{1,4});
set(handles.char,'String',C{1,5});
set(handles.charCol,'String',C{1,6});
set(handles.GLat,'String',C{1,7});
set(handles.GLong,'String',C{1,8});
set(handles.Orient,'String',C{1,9});
Cpathname = 'C:\Users\Vikcy\Desktop\Flight Images\';
Cfilename = 'I.jpg'
Cvar=strcat(Cpathname,Cfilename);
CORI_IMG=imread(Cvar);
%axis(handles.axes1);
%imshow(CORI_IMG);
imshow(CORI_IMG,'Parent',handles.axes1)
Tpathname = 'C:\Users\Vikcy\Desktop\Flight Images\';
Tvar=strcat(Tpathname,Tfilename);
TORI_IMG=imread(Tvar);
%axis(handles.axes2);
%imshow(TORI_IMG);
imshow(TORI_IMG,'Parent',handles.axes2)
axes(handles.axes1);
imshow(image)
% --- Executes on button press in nexTar.
function nexTar_Callback(hObject, eventdata, handles)
% hObject handle to nexTar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Tfilename;
global Tpathname;
global I;
global J;
J=int32(str2num(J));
J=J+1
J=int2str(J);
Tfilename = strcat(I,'-',J,'.jpg');
fid = fopen('C:\Users\Vikcy\Desktop\Flight Images\Values.txt');
for i = 1:count
tline = fgetl(fid);
end
C = strsplit(tline,{',',' ','[',']'});
set(handles.fname,'String',C{1,2});
set(handles.shape,'String',C{1,3});
set(handles.shaColor,'String',C{1,4});
set(handles.char,'String',C{1,5});
set(handles.charCol,'String',C{1,6});
set(handles.GLat,'String',C{1,7});
set(handles.GLong,'String',C{1,8});
set(handles.Orient,'String',C{1,9});
Cpathname = 'C:\Users\Vikcy\Desktop\Flight Images\';
Cfilename = 'I.jpg'
Cvar=strcat(Cpathname,Cfilename);
CORI_IMG=imread(Cvar);
%axis(handles.axes1);
%imshow(CORI_IMG);
imshow(CORI_IMG,'Parent',handles.axes1)
Tpathname = 'C:\Users\Vikcy\Desktop\Flight Images\';
Tvar=strcat(Tpathname,Tfilename);
TORI_IMG=imread(Tvar);
%axis(handles.axes2);
%imshow(TORI_IMG);
imshow(TORI_IMG,'Parent',handles.axes2)
axes(handles.axes1);
imshow(image)
答案 0 :(得分:1)
函数以end语句,文件末尾或本地函数的定义行结束,以先到者为准。 如果符合以下条件,则需要结束语句:
- 文件中的任何函数都包含嵌套函数(完全包含在其父级中的函数)。
- 该函数是函数文件中的本地函数,文件中的任何本地函数都使用end关键字。
- 该函数是脚本文件中的本地函数。
您在函数end
中使用Orient_CreateFcn
关键字,因此所有本地函数都需要end
语句。
无论如何,这是一个很好的编码实践,因为它使您的代码更清晰。例如,它阐明了本地函数是否嵌套而不必找到父函数end
答案 1 :(得分:0)
第45行还有一个obj = AssetMetadata.objects.get(id=pk)
obj.batch_set.add(* batch_list)
,只需将其删除即可。见下文
end