Editable Table in MATLAB Matlab script

SPONSORED LINKS

    Specification

  • Version:
  • File size: 0 KB
  • File name: mltable.m
  • Last update:
  • Platform: Windows / Linux / Mac OS / BSD / Solaris
  • Language: Matlab
  • Price:Freeware
  • Company: Morris Maynard (View more)

Editable Table in MATLAB script description:




Publisher review:
Editable Table in MATLAB - A table that can be added to a figure; with editing and scrolling. This provides a table as a separate MATLAB script which can be called from any figure. The table can reside within a figure with other UI controls. The fields can be edited and the table can be scrolled. Numeric or string fields are supported. More than one table per figure should be possible.You can create a table as follows (just running the script with no arguments does this):fig = nf;tbl = axes('units', 'pixels','position', [10 10 400 100]);cell_data = {... 'Alpha', 1, 2, 3,'';...'Bravo', 4, 5, 6,'';...'Charlie', 7, 8, 9,'';...'Dog', 10,11,12,'';...'Echo', 13,14,15,'';...'Foxtrot',16,17,18,'';...'Golf', 19,20,21,'';...'Hotel', 26,27,28,'';...};columninfo.titles={'Param','Lower Limit','Upper Limit',...'Initial Value','Result'};columninfo.formats = {'%4.6g','%4.6g','%4.6g','%4.6g','%4.6g'};columninfo.weight = [ 1, 1, 1, 1, 1];columninfo.multipliers = [ 1, 1, 1, 1, 1];columninfo.isEditable = [ 1, 1, 1, 1, 0];columninfo.isNumeric = [ 0, 1, 1, 1, 1];columninfo.withCheck = true;columninfo.chkLabel = 'Use';rowHeight = 16;gFont.size=9;gFont.name='Helvetica';mltable(fig, tbl, 'CreateTable', columninfo, rowHeight, cell_data,... gFont);When you click on a cell which is "Editable", the cell changes color. When you click again, the editing cursor appears and you can edit the cell contents. To finish editing, press then Enter key or click on another cell. If you use the table in a GUI form designed with GUIDE, you probably want to end the editing when you click on another part of the form. To do this, add the following lines after the one which creates the table:endfcn = sprintf('mltable(.13f, .13f, ''SetCellValue'');',...hObject,handles.tblParams);set(hObject,'buttondownfcn',endfcn);To get the current table contents, use:info = get(tbl,'UserData');data = info.data;The variable "data" now contains a cell array of the table contents.This describes the "columninfo" structure:Titles: array of strings to place above each column. Use '' for non-labeled columns.Weight: array of column widths. Use 1 for unit width, > 1 for wider columns. This does not work for column 1 (bug!)Multipliers: Use to scale numeric values. For instance, if Multiplier for column 2 is set to .01, then the value displayed in column 2 will always be 1/100 of the value in the data array.Formats: sprintf style formats for each column. Ignored for non-numerics. Use '%f' if in doubt.IsEditable: array of 1s and 0s for each column. 0 means column is read-only.isNumeric: array or 1s and 0s for each column. 1 means treat column as numeric (will do scaling by Multiplier, check for non-numeric input, and will store the value as a number, not a string.)withCheck: optional field; if set to "true", the table will have a column of checkboxes along the left side.chkLabel: optional field: if set to a string, this will be placed above the column of checkboxes if there is one.rowsFixed: the table won't have buttons for insert/delete rows, even if some fields are editableHow to use check boxes:If use set a field named 'withCheck' in columnInfo to 'true', then the table will have a column of checkboxes along the left hand side. You can set the initial state of the check boxes with code like this:for ii = 1:numrowsmltable(fig, tbl, 'SetCheck',[],[],[],[],ii, checkval(ii));endassuming that checkval is a vector of 1s and 0s to determine the initial state.After the figure is created, you can get the state of the checkboxes with code like this:data = get(tbl, 'UserData');checkval = data.isChecked;and now checkval is a vector of 1s and 0s depending on the checkbox states.How to use DoubleClickYou can have the table call your own routine when the user double clicks on a cell.mltable(fig, hobj, 'SetDblClick', 'Myfunc', 'fmt_str');where 'Myfunc' is a string naming the function to call, and 'fmt_str' is a string representing additionial arguments. If you are using the table in a Guide figure, use SetDblClick like this:mltable(gcf, handles.tbl, 'SetDblClick', [], [], [], [], 'myfig', 'dblClick_Callback');where 'myfig' is the name of the main figure and dblClick_Callback is a function within that figure's main file.Your function will be called as[] = Myfunc(hObject, [], handles, arg1, arg2, ...)where arg1, arg2, etc are the argument names you passed to SetDblClick in the format string. Requirements: ยท MATLAB Release: R14SP2
Editable Table in MATLAB is a Matlab script for Development Tools scripts design by Morris Maynard. It runs on following operating system: Windows / Linux / Mac OS / BSD / Solaris.

Operating system:
Windows / Linux / Mac OS / BSD / Solaris

Latest script and internet news

222

222

22

Posted on: 18 Jul 2023 22:27 by A. Brown

111

111

111

Posted on: 18 Jul 2023 22:24 by A. Brown

The permanently active Push system offered by the new Google Chrome 42

The permanently active Push system offered by the new Google Chrome 42

Hacked By !Sc-sT

Posted on: 17 Mar 2015 07:57 by A. Brown

SPREAD THE WORD

User Rating


Rating: 2.2 out of 5
Based on 13 ratings. 13 user reviews.

  • Currently 2.15 out of 5
  • 1
  • 2
  • 3
  • 4
  • 5