editable table

Example of an editable table with control over which characters are valid

이 제출물을 팔로우합니다

CREATABLE.M, WINDOWCLICK.M, EDITABLE.M

This is an example to show how an editable table can be created without using MATLAB's edit uicontrol. It has the advantage that you have more control over how key presses and mouse clicks are handled. You can limit the user input to certain characters, control the behaviour of arrow keys, etc..

In this example a table with numeric values is created in the current axis using CREATABLE.M. CREATABLE(NR,NC) creates a table with NR rows and NC columns filled with zeros. CREATABLE(DATA) creates a table with the same size as the DATA matrix and filled with the values of DATA.

WINDOWCLICK.M handles mouse button clicks inside the table (to start editing) and outside the table (to stop editing). It is also called by certain key presses that have the same effect as a mouse button click (arrow keys, enter, escape).

EDITABLE.M handles keyboard presses. Once a certain table cell has been clicked, any valid numeric character (including '+', '-', '.' and 'e') can be typed.

Furthermore, 'delete' empties the cell contents, 'backspace' removes the right-most character, 'arrow keys' move to another cell, 'enter' reselects the current cell, 'escape' (or clicking with the mouse outside the table) stops editing. The DATA is stored in the userdata of the current axes, thus at any time
during or after editing: DATA = GET(GCA,'USERDATA'). If a table cell contains an invalid number, NaN is returned for that cell.

These functions do not form a ready-to-use uicontrol. They are meant to be adapted for your own needs. Therefore, the functions have been kept as short as possible and no error checking (e.g. on typing beyond the cell width) is performed. The functions have been developed with MATLAB 7.0 (R14) and have also been tested with MATLAB 6.1 (R12).

인용 양식

Peter Graat (2026). editable table (https://kr.mathworks.com/matlabcentral/fileexchange/7026-editable-table), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Tables에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0