⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g_homework.asv

📁 digital signal processing常用工具箱
💻 ASV
📖 第 1 页 / 共 2 页
字号:
                '   set(ht(i),''Visible'',''on''), '...
                'end, '...
                'set(hc_course,''Visible'',''on''), '...
                'set(hc_homework,''Visible'',''on''), '...
                'set(hc_date,''Visible'',''on''), '...
                'set(hc_sec,''Visible'',''on''), '...
                'set(hc_showsec,''Visible'',''on''), '...
                'set(ht_course,''Visible'',''on''), '...
                'set(ht_homework,''Visible'',''on''), '...
                'set(ht_date,''Visible'',''on''), '...
                'set(ht_sec,''Visible'',''on''), '...
                'set(hc_select,''Visible'',''on''), '...
                'set(hc_delete,''Visible'',''on''), '...
                'set(hc_insert,''Visible'',''on''), '...
                'set(hc_random,''Visible'',''on''), '...
               ]; 
hm_6 = uimenu (hf_1,'Label','Print');
hm_61 = uimenu (hm_6,'Label','Print homework assignment','Callback',cback_print1);

warn = {'This option requires are postscript printer.',...
        'Do you have a post-script printer?'};

cback_print2 = [
                'button = questdlg (warn,''Postscript printer available?'',''yes'',''no'',''no''); '...
                'if strcmp(button,''yes''), '...
                    cback_print1
                    'print -v,'...
                    'np = length(prob); '...
                    'for i = 1 : np, '...
                    '   q = problems{prob(i),2}; '...
                    '   ps_file = which([''prob'' q(1) ''_'' q(3:end) ''.ps'']); '...
                    '   eval( [''system('' quote ''copy '' ps_file space ''LPT1:'' quote '');''] ); '...
                    'end, '...
                    'clc; '...
                'end; '
               ];
hm_62 = uimenu (hm_6,'Label','Print homework solution (Postscript Printer)','Callback',cback_print2);

% Help and exit menu options

f_helpmenu ('f_tipshome','g_homework')
f_exitmenu 

% Add pushbuttons 

axes(han(1))
wbox = 0.15;
hbox = 0.036;
nrow = 4;
ncol = 2;
cback = '';
xtext = 0.65;
dh = (1 - (nrow-1)*hbox/pos(1,4))/nrow;
dv = 1.5*hbox;

% Course number

cback_course = ['def_course = course_number; '...
                'course_number = inputdlg (''Enter the course number'','...
                '''Specify the course number'',1,def_course); '...
                'set(ht_course,''String'',course_number); '...
                'setpref (''FDSP_preferences'',''course_number'',course_number); '...
                plotstr];
hc_course = f_pushbutton (pos(1,:),nrow,ncol,1,1,'Course number',colors(1,:),white,cback_course,...
                         'Specify the number or name of the course',fsize,wbox,hbox);
ht_course = text (xtext,1 + dv - (dh+hbox),course_number);
set (ht_course,'Color','r')

% Homework number
                     
cback_homework = ['[s,v] = listdlg(''PromptString'','...
                 '''Select the homework assignment number.'','...
                 '''ListSize'',[200 300],'...
                 '''SelectionMode'',''single'','...
                 '''ListString'',nums); '...
                 'homework_number = nums{s}; '...
                 'set(ht_homework,''String'',homework_number); '...
                  plotstr];
hc_homework = f_pushbutton (pos(1,:),nrow,ncol,2,1,'Homework number',colors(1,:),white,cback_homework,...
                         'Select the number of the homework assignment',fsize,wbox,hbox);
ht_homework = text (xtext,1 + dv - 2*(dh+hbox),homework_number);
set (ht_homework,'Color','r')

% Due date

cback_date = ['def_date = {due_date}; '...
              'due_date = char(inputdlg (''Enter the homework due date'', '...
              '''Specify the homework due date'',1,def_date)); '...
              'set(ht_date,''String'',due_date); '...
               plotstr];
hc_date = f_pushbutton (pos(1,:),nrow,ncol,3,1,'Due date',colors(1,:),white,cback_date,...
                         'Specify the due date of the homework assignment',fsize,wbox,hbox);
ht_date = text (xtext,1 + dv - 3*(dh+hbox),due_date);
set (ht_date,'Color','r')

% Section numbers

cback_sec = ['[s1,v] = listdlg(''PromptString'','...
             '[{''Select the FIRST section from which''};'...
             ' {''homework problems are to be assigned.''}],'...
             '''ListSize'',[300 300],'...
             '''SelectionMode'',''single'','...
             '''ListString'',secs); '...
             'sec{1} = secs{s1}; '...
             '[s2,v] = listdlg(''PromptString'','...
             '[{''Select the LAST section from which''};'...
             ' {''homework problems are to be assigned.''}],'...
             '''ListSize'',[300 300],'...
             '''SelectionMode'',''single'','...
             '''ListString'',secs(s1:end)); '...
             'sec{2} = secs{s1+s2-1}; '...
             'set(ht_sec,''String'',[char(sec{1}) '' to '' char(sec{2})]); '...
             plotstr];
 
hc_sec = f_pushbutton (pos(1,:),nrow,ncol,4,1,'Section numbers',colors(1,:),white,cback_sec,...
                         'Specify the section numbers for selecting problems',fsize,wbox,hbox);
ht_sec = text (xtext,1 + dv - 4*(dh+hbox),[sec{1} ' to ' sec{2}]);
set (ht_sec,'Color','r')
                      
% Select problems                      

ncol = 1;
wbox = 1.5*wbox;
cback_select = [cprobstr ...
                '[s,v] = listdlg(''PromptString'','...
                '[{''Select the homework problems. Hold down''};'...
                 '{''the Ctrl key to select multiple problems.''}],'...
                '''ListSize'',[300 300],'...
                '''ListString'',clist);'...
                'prob = cprobs(s); '...
                'np = length(s); '...
                plotstr]; 

hc_select = f_pushbutton (pos(2,:),nrow,ncol,1,1,'Select problems',colors(2,:),white,cback_select,...
                          'Select homework problems from a list',fsize,wbox,hbox);

% Delete problems                      
                      
cback_delete = ['problist = problems(prob,2); '...
                '[s,v] = listdlg(''PromptString'','...
                '[{''Select the homework problems to delete.  Hold ''};'...
                 '{''down the Ctrl key to select multiple problems.''}],'...
                '''ListSize'',[300 300],'...
                '''ListString'',problist);'...
                'prob(s) = []; '...
                'np = length(prob); '...
                plotstr]; 

hc_delete = f_pushbutton (pos(2,:),nrow,ncol,2,1,'Delete problems',colors(2,:),white,cback_delete,...
                           'Delect homework problems',fsize,wbox,hbox);

% Insert problems                      
                       
cback_insert = [cprobstr ...
                '[s,v] = listdlg(''PromptString'','...
                '[{''Select the homework problems to insert. Hold''};'...
                 '{''down the Ctrl key to select multiple problems.''}],'...
                '''ListSize'',[300 300],'...
                '''ListString'',clist);'...
                'prob = [prob cprobs(s)]; '...
                'prob = sort(prob); '...
                'np = length(prob); '...
                plotstr]; 

hc_insert = f_pushbutton (pos(2,:),nrow,ncol,3,1,'Insert problems',colors(2,:),white,cback_insert,...
                           'Insert homework problems',fsize,wbox,hbox);
                       
% Generate random problems

cback_random = [rprobstr  plotstr];
hc_random = f_pushbutton (pos(2,:),nrow,ncol,4,1,'Generate random problems',colors(2,:),white,...
                          cback_random,'Create a random homework assigment',fsize,wbox,hbox);

% Checkbox                       
           
axes (han(3))
p = pos(3,:);
hc_showsec = uicontrol(gcf,...
   'Style','checkbox',...
   'Units','normalized',...
   'FontName','FixedWdithFontName',...
   'FontSize',fsize,...
   'Position',[p(1)+0.6*p(3),p(2)+1.0*p(4),.12 .035],...
   'Value',show_sec, ...
   'String','Show sections',...
   'ForeGroundColor',colors(1,:),...
   'BackGroundColor',get(gcf,'Color'),...
   'Visible','on',...
   'Tooltip','Toggle the display of section information');
cback_showsec = ['show_sec = 1-show_sec; '...
                  plotstr];
set (hc_showsec,'Callback',cback_showsec)

% Display initial homework assignment

eval (cprobstr)
[prob,np] = f_randprob (np,sec,problems,0,nums);
eval (plotstr)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -