[4] | 1 | function [handle] = quad_table(title, name, value, position) |
---|
| 2 | % [handle, b] = quad_table(title, name, value) title is a string name is a |
---|
| 3 | % column of strings with the names of the quads value is a column of |
---|
| 4 | % strings with the values of the quads handle is handle to the mathworks |
---|
| 5 | % MWFrame b is a handle to mathworks MWListbox b.getSelectedRows => gets |
---|
| 6 | % you the index of the row currently selected by mouse, beginning with |
---|
| 7 | % zero!!! -- example: [handle, b] = gui_sheet('nice table', qualist, |
---|
| 8 | % vallist) |
---|
| 9 | % |
---|
| 10 | % |
---|
| 11 | % requires Java runtime environment installed and mathworks components ver. |
---|
| 12 | % 0.5 |
---|
| 13 | |
---|
| 14 | % GPL License (www.google.com), feel free to modify it, if you have any |
---|
| 15 | % questions or interesting modifications, please send an email. there is a |
---|
| 16 | % problem with some screen resolutions, you can modify it according to your |
---|
| 17 | % needs, or add another input parameters you can access: cursor position, |
---|
| 18 | % data in the table, visibility of the listbox or frame data. this file is |
---|
| 19 | % far from complete, it is just an example on how to put a table into |
---|
| 20 | % matlab gui (in this case only external window) if you have any idea on |
---|
| 21 | % how to put a table into an existing gui window, i`ll be very thankful for |
---|
| 22 | % hints and tips. |
---|
| 23 | |
---|
| 24 | ncol=2; |
---|
| 25 | nrows=size(name,2); |
---|
| 26 | data = cell(nrows,2); |
---|
| 27 | |
---|
| 28 | for i=1:nrows, |
---|
| 29 | data(i,:)=[name(i) value(i)] ; |
---|
| 30 | end |
---|
| 31 | |
---|
| 32 | t = uitable(data,[{'Name'} {'k'}]); |
---|
| 33 | set(t,'Editable',false); |
---|
| 34 | set(t,'Units','normalized') |
---|
| 35 | set(t,'Position',position); |
---|
| 36 | handle=t; |
---|