1 function editmatrix(A,varargin)
\r
2 % Sorry, I didn't have enough time to write nice and documented GUI code.
\r
4 % Toolbox for nonlinear filtering.
\r
5 % Copyright (C) 2005 Jakob Rosén <jakob.rosen@gmail.com>
\r
7 % This program is free software; you can redistribute it and/or
\r
8 % modify it under the terms of the GNU General Public License
\r
9 % as published by the Free Software Foundation; either version 2
\r
10 % of the License, or (at your option) any later version.
\r
12 % This program is distributed in the hope that it will be useful,
\r
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 % GNU General Public License for more details.
\r
17 % You should have received a copy of the GNU General Public License
\r
18 % along with this program; if not, write to the Free Software
\r
19 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
\r
22 hf=figure('Name','Edit Matrix','NumberTitle','off','Units','Characters');
\r
25 uicontrol('Style','Edit','String',num2str(m),'Units','Characters','Tag','rows','Position',[0,0.5,5,1.5]);
\r
26 uicontrol('Style','Text','String','x','Units','Characters','Position',[5,0.5,5,1.5]);
\r
27 uicontrol('Style','Edit','String',num2str(n),'Units','Characters','Tag','columns','Position',[10,0.5,5,1.5]);
\r
28 uicontrol('Style','Pushbutton','String','Resize/Clear','Units','Characters','Position',[20,0.5,20,1.5],'Callback',['editmatrix(''resize'',',num2str(hf),')']);
\r
29 uicontrol('Style','Pushbutton','String','Save','Units','Characters','Position',[50,0.5,20,1.5],'Callback',['editmatrix(''save'',',num2str(hf),')']);
\r
30 uicontrol('Style','Pushbutton','String','Cancel','Units','Characters','Position',[70,0.5,20,1.5],'Callback',['delete(',num2str(hf),')']);
\r
31 uicontrol('Style','Frame','Units','Characters','Position',[0,3,90,0.1]);
\r
32 elseif strcmp(A,'resize')
\r
34 handles=guidata(hf);
\r
40 % Delete edit controls
\r
43 delete(handles.(['edit',num2str(j),'_',num2str(i)]));
\r
47 % Generate new values
\r
48 m=str2num(get(handles.rows,'string'));
\r
49 n=str2num(get(handles.columns,'string'));
\r
53 % Generate the edit matrix
\r
56 uicontrol('Style','Edit','String',num2str(A(j,i)),'Units','Characters','Tag',['edit',num2str(j),'_',num2str(i)],'Position',[10*(i-1),3*(m-j)+0.5+4,7,1.5]);
\r
61 handles=guihandles(hf);
\r
63 guidata(hf,handles);
\r