1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Description of update_menu</title> |
---|
6 | <meta name="keywords" content="update_menu"> |
---|
7 | <meta name="description" content="'update_menu': find an input string in a menu, add it to the menu at the penultimate position if it does not exist"> |
---|
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
---|
10 | <meta name="robots" content="index, follow"> |
---|
11 | <link type="text/css" rel="stylesheet" href="../m2html.css"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <a name="_top"></a> |
---|
15 | <div><a href="../index.html">Home</a> > <a href="index.html">.</a> > update_menu.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>update_menu |
---|
21 | </h1> |
---|
22 | |
---|
23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
24 | <div class="box"><strong>'update_menu': find an input string in a menu, add it to the menu at the penultimate position if it does not exist</strong></div> |
---|
25 | |
---|
26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
27 | <div class="box"><strong>function menu_str=update_menu(handle,strinput) </strong></div> |
---|
28 | |
---|
29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
30 | <div class="fragment"><pre class="comment">'update_menu': find an input string in a menu, add it to the menu at the penultimate position if it does not exist |
---|
31 | ----------------------------------------------- |
---|
32 | function menu_str=update_menu(handle,strinput) |
---|
33 | |
---|
34 | OUTPUT: |
---|
35 | menu_str: new menu; cell of strings |
---|
36 | |
---|
37 | INPUT: |
---|
38 | handle: handle of the menu to modify (listbox uicontrol) |
---|
39 | strinput: char string to detect or add in the menu</pre></div> |
---|
40 | |
---|
41 | <!-- crossreference --> |
---|
42 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
43 | This function calls: |
---|
44 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
45 | </ul> |
---|
46 | This function is called by: |
---|
47 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
48 | <li><a href="get_field.html" class="code" title="function varargout = get_field(varargin)">get_field</a> 'get_field': display variables and attributes from a Netcdf file, and plot selected fields</li><li><a href="series.html" class="code" title="function varargout = series(varargin)">series</a> 'series': master function associated to the GUI series.m for analysis field series</li><li><a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a> 'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization</li></ul> |
---|
49 | <!-- crossreference --> |
---|
50 | |
---|
51 | |
---|
52 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
53 | <div class="fragment"><pre>0001 <span class="comment">%'update_menu': find an input string in a menu, add it to the menu at the penultimate position if it does not exist</span> |
---|
54 | 0002 <span class="comment">%-----------------------------------------------</span> |
---|
55 | 0003 <span class="comment">% function menu_str=update_menu(handle,strinput)</span> |
---|
56 | 0004 <span class="comment">%</span> |
---|
57 | 0005 <span class="comment">% OUTPUT:</span> |
---|
58 | 0006 <span class="comment">% menu_str: new menu; cell of strings</span> |
---|
59 | 0007 <span class="comment">%</span> |
---|
60 | 0008 <span class="comment">% INPUT:</span> |
---|
61 | 0009 <span class="comment">% handle: handle of the menu to modify (listbox uicontrol)</span> |
---|
62 | 0010 <span class="comment">% strinput: char string to detect or add in the menu</span> |
---|
63 | 0011 |
---|
64 | 0012 <a name="_sub0" href="#_subfunctions" class="code">function menu_str=update_menu(handle,strinput)</a> |
---|
65 | 0013 menu_str=get(handle,<span class="string">'String'</span>); |
---|
66 | 0014 nbmenu=length(menu_str); |
---|
67 | 0015 ichoice=0;<span class="comment">%default</span> |
---|
68 | 0016 <span class="keyword">for</span> imenu=1:nbmenu |
---|
69 | 0017 <span class="keyword">if</span> isequal(menu_str{imenu},strinput) |
---|
70 | 0018 ichoice=imenu; |
---|
71 | 0019 <span class="keyword">end</span> |
---|
72 | 0020 <span class="keyword">end</span> |
---|
73 | 0021 <span class="keyword">if</span> ichoice==0<span class="comment">%the input string does not exist in the menu</span> |
---|
74 | 0022 menu_str{nbmenu+1}=menu_str{nbmenu};<span class="comment">%shift the last item ('more...')</span> |
---|
75 | 0023 menu_str{nbmenu}=strinput; |
---|
76 | 0024 set(handle,<span class="string">'String'</span>,menu_str) |
---|
77 | 0025 ichoice=nbmenu; |
---|
78 | 0026 <span class="keyword">end</span> |
---|
79 | 0027 set(handle,<span class="string">'Value'</span>,ichoice)</pre></div> |
---|
80 | <hr><address>Generated on Fri 13-Nov-2009 11:17:03 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
---|
81 | </body> |
---|
82 | </html> |
---|