diff --git a/en/README.md b/en/README.md index 664f748d..bbea8e8a 100644 --- a/en/README.md +++ b/en/README.md @@ -1,96 +1,84 @@ ![banner](banner_homepage.png) -### Nelson 1.7.0.0 +### Nelson 1.8.0.0 -Nelson is an interactive, fully functional environment for engineering and scientific applications. It implements a matrix-driven language (which is largely compatible with MATLAB and GNU Octave), with advanced features such as 2-D 3-D plotting, image manipulation and viewing, a codeless interface to external C/C++/FORTRAN libraries, native support for various C types, and a host of other features. +Nelson is a powerful, open-source numerical computational language, developed to provide a comprehensive and intuitive environment for engineers, scientists, and students. With over 1,200 built-in functions, Nelson supports a wide range of tasks, from basic algebra to advanced numerical simulations. -Try it ! +Originally inspired by languages like MATLAB© and GNU Octave, Nelson offers users a lightweight yet feature-rich experience. It is designed to be easy to learn and use, with an emphasis on performance and flexibility. -[Web site](https://nelson-lang.github.io/nelson-website/) +**Try it now!** -## Features - -- Types managed by Nelson: - - - double and double complex: scalar, vector, matrix 2D, N dimensions array, sparse matrix. - - single and single complex: scalar, vector, matrix 2D, N dimensions array, sparse matrix. - - logical: scalar, vector, matrix 2D, N dimensions array, sparse matrix. - - character array (UNICODE supported). - - string array (UNICODE supported). - - integers 8, 16, 32, 64 signed and unsigned: scalar, vector, matrix 2D, N dimensions array. - - handle objects. - - anonymous functions, - - all types can be overloaded. - -- `OpenMP` and `SIMD` extensions used. - -- 2D and 3D plotting with high-level plot commands. - -- Desktop environment with history, file and workspace browser. - -- Parallel Computing Module. - -- Fast Fourrier Transformation functions based on FFTW and MKL wrapper. - -- SLICOT (Subroutine Library in Systems and Control Theory) interfaces (optional). +[Site Web](https://nelson-lang.github.io/nelson-website/) -- Control System module. - -- Message Passing Interface (MPI): functions for parallel computing. - -- JSON decode/encode data support. - -- HDF5 high-level functions I/O, - -- HDF5 used as default data file format (.nh5) load/save workspace, - -- MAT-file compatible load/save workspace, - -- Foreign Function Interface C/Fortran. - -- Interfacing C/C++ or Fortran with Nelson (build and load external code on the fly). - -- MEX C API compatibility. +## Features -- Call Python from Nelson. +### Data Types Managed by Nelson -- Nelson Engine API for C (compatible with MEX Engine). Call Nelson from your C code as engine. +- **Double and Complex Double**: Supports scalars, vectors, 2D matrices, N-dimensional arrays, and sparse matrices. +- **Single and Complex Single**: Includes scalars, vectors, 2D matrices, N-dimensional arrays, and sparse matrices. +- **Logical**: Handles scalars, vectors, 2D matrices, N-dimensional arrays, and sparse matrices. +- **Character Arrays**: Supports UNICODE characters. +- **String Arrays**: Fully supports UNICODE. +- **Integers**: 8, 16, 32, and 64-bit signed and unsigned scalars, vectors, 2D matrices, and N-dimensional arrays. +- **Handle Objects**: For object-oriented functionality. +- **Anonymous Functions**: Allows creation and manipulation of functions without names. +- **Data Structures**: Supports dictionaries and tables. +- **Overloading**: All types can be overloaded for custom behavior. -- RESTful API web service. +### Performance Enhancements -- Inter-process communication between Nelson's process. +- **OpenMP and SIMD**: Utilizes parallel processing and vectorization for faster computations. -- The QML engine enables nelson programs to display and manipulate graphical content using Qt's QML framework. +### Visualization & Interface -- Component Object Model (COM) client interface: binary-interface standard for software components on Windows. +- **2D and 3D Plotting**: High-level commands for visualizations. +- **User Interface Controls**: Built-in controls for creating custom interfaces. +- **Desktop Environment**: Comes with history tracking, a file explorer, and workspace browser. -- Write/Read xlsx files on Windows using COM. +### Advanced Modules -- Embedded Nelson code editor. +- **Parallel Computing**: Enables efficient use of multi-core processors. +- **Fast Fourier Transform (FFT)**: High-performance FFT functions based on FFTW and MKL. +- **SLICOT Interface**: Optional support for the Systems and Control Theory subroutine library. +- **Control System Module**: Tools for control theory and system design. +- **MPI (Message Passing Interface)**: Functions for distributed parallel computing. -- Help engine: +### Data Formats & Interfacing - Generate help files using Nelson dedicated functions. - View your generated help files as html, markdown, pdf, gitbook or directly in Nelson help viewer. +- **JSON Support**: Read and write JSON files. +- **HDF5 Functions**: High-level I/O functions, with HDF5 as the default file format for `.nh5` workspaces. +- **MAT-File Compatibility**: Load and save workspaces in MAT-file format. +- **Foreign Function Interface (FFI)**: Build and load C/Fortran code on the fly. +- **MEX C API Compatibility**: Interfacing with MEX-compatible C APIs. +- **Nelson Engine API**: Use Nelson as a backend engine within C code, compatible with the MEX Engine API. +- **Python Interfacing**: Call Python scripts and functions from Nelson. +- **RESTful API**: Enables Nelson to interact with web services. -- Tests engine: +### Additional Capabilities - Validate your algorithm using Nelson dedicated functions. - Export the test results under the xUnit reports format. +- **Inter-Process Communication**: Communicate between Nelson processes. +- **QML Engine**: Use Qt’s QML framework to display and manipulate graphical content. +- **Component Object Model (COM)**: Interface with COM components, especially on Windows. +- **Excel File Support**: Write and read `.xlsx` files using COM on Windows. +- **Embedded Code Editor**: Integrated editor for Nelson scripts. -- Profiling and Code coverage tools for Nelson's language: +### Help & Testing Tools - Nelson has a built-in profiler that is very useful to profile your code and find out what script or function is taking the most time. +- **Help Engine**: Generate and view help files in various formats like HTML, Markdown, PDF, or GitBook. +- **Test Engine**: Validate algorithms using built-in functions, with support for xUnit report export. -- [Nelson cloud](https://www.npmjs.com/package/nelson-cloud): - Instant access to Nelson anywhere from an web browser. +### Profiling & Code Coverage -- Module skeleton to extend Nelson available here: +- **Profiler**: Built-in profiler to analyze and optimize code performance. +- **Code Coverage**: Measure the coverage of your tests to ensure thorough validation. - - [template macros and builtin](https://github.com/nelson-lang/module_skeleton), - - [basic template macros only](https://github.com/nelson-lang/module_skeleton_basic). +### Cloud & Extensibility -- Nelson Modules Manager (nmm) : package manager for Nelson +- **Nelson Cloud**: Instant access to Nelson from any web browser via [Nelson Cloud](https://www.npmjs.com/package/nelson-cloud). +- **Module Skeleton**: Templates for extending Nelson: + - [Template with Macros and Builtins](https://github.com/nelson-lang/module_skeleton). + - [Basic Macros Template](https://github.com/nelson-lang/module_skeleton_basic). +- **Nelson Modules Manager (nmm)**: A package manager to install and manage extensions for Nelson. --- diff --git a/en/SUMMARY.md b/en/SUMMARY.md index 6b355fbd..1c48edb3 100644 --- a/en/SUMMARY.md +++ b/en/SUMMARY.md @@ -208,6 +208,20 @@ - [types](./dictionary/types.md) - [values](./dictionary/values.md) +- [table](./table/README.md) + + - [Accessing and Manipulating Tables in Nelson](./table/accessing_manipulating_table.md) + - [array2table](./table/array2table.md) + - [cell2table](./table/cell2table.md) + - [height](./table/height.md) + - [istable](./table/istable.md) + - [struct2table](./table/struct2table.md) + - [table](./table/table.md) + - [table2array](./table/table2array.md) + - [table2cell](./table/table2cell.md) + - [table2struct](./table/table2struct.md) + - [width](./table/width.md) + - [integer](./integer/README.md) - [int16](./integer/int16.md) @@ -707,6 +721,7 @@ - [cputime](./time/cputime.md) - [date](./time/date.md) - [datenum](./time/datenum.md) + - [datestr](./time/datestr.md) - [datevec](./time/datevec.md) - [eomday](./time/eomday.md) - [etime](./time/etime.md) diff --git a/en/changelogs/CHANGELOG.md b/en/changelogs/CHANGELOG.md index 6f05aa48..2fc8463a 100644 --- a/en/changelogs/CHANGELOG.md +++ b/en/changelogs/CHANGELOG.md @@ -5,7 +5,51 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 1.7.0 (2024-08-27) +## 1.8.0 (2024-10-04) + +### Added + +- **`table` Data Type**: + + - Introduced the `table` data type, offering enhanced functionality for structured data manipulation. + + - Overloaded methods specific to the `table` data type: + + - `disp`, `display` for table display. + - `horzcat`, `vertcat` for horizontal and vertical concatenation. + - `isempty` to check if the table is empty. + - `isequal`, `isequalto` for table comparison. + - `properties` for accessing table metadata. + - `subsasgn` for subscripted assignment. + - `subsref` for subscripted referencing. + + - Conversion functions added: + + - `array2table`: Convert an array to a table. + - `cell2table`: Convert a cell array to a table. + - `struct2table`: Convert a structure to a table. + - `table2array`: Convert a table to an array. + - `table2cell`: Convert a table to a cell array. + - `table2struct`: Convert a table to a structure. + + - Utility functions introduced: + - `width`: Retrieve the number of columns in the table + - `height`: Retrieve the number of rows in the table + - `istable`: Check if a variable is of the `table` data type + +- `Resize` - Resize figure property. +- [#36](http://github.com/nelson-lang/nelson/issues/36) `datenum` format compatibility extended. +- [#37](http://github.com/nelson-lang/nelson/issues/37) `datestr` Convert date and time to string format. + +### Changed + +- CodeQL Github action updated. + +### Fixed + +- fix 'units' refresh for 'axes' object. + +## 1.7.0 (2024-08-28) ### Added diff --git a/en/graphics/figure.md b/en/graphics/figure.md index fa939a44..3759744e 100644 --- a/en/graphics/figure.md +++ b/en/graphics/figure.md @@ -43,6 +43,7 @@ Creates an figure window.

Parent: Figure parent: root graphics object.

Position: Location and size of drawable area: [left, bottom, width, height]

'width' and 'height' define the size of the window. 'left' and 'bottom' define the position of the first addressable pixel in the lower left corner of the window

+

Resize: Resize figure: 'on' or 'off' (default).

Tag: Object identifier: string scalar, character vector, '' (default).

ToolBar: Figure toolbar display: 'none', 'auto' (default), 'figure'.

Type: Type 'figure'.

@@ -81,6 +82,7 @@ figure('Name', 'Hello') | 1.2.0 | Clicking on an figure automatically sets it as the current figure object. | | 1.7.0 | CreateFcn, DeleteFcn, CloseRequestFcn, KeyPressFcn, KeyReleaseFcn, ButtonDownFcn callback added. | | -- | BeingDeleted property added. | +| 1.8.0 | Resize property added. | ## Author diff --git a/en/table/README.md b/en/table/README.md new file mode 100644 index 00000000..7d6fe4a8 --- /dev/null +++ b/en/table/README.md @@ -0,0 +1,19 @@ +# Tables + +Tables + +## Description + +Tables of arrays with named columns, each potentially containing different data types. + +- [Accessing and Manipulating Tables in Nelson](accessing_manipulating_table.md) +- [array2table](array2table.md) - Convert homogeneous array to table. +- [cell2table](cell2table.md) - Convert cell array to table. +- [height](height.md) - Number of table rows +- [istable](istable.md) - Determine if input is table. +- [struct2table](struct2table.md) - Convert a structure array into a tabular format. +- [table](table.md) - A table-like array with named variables, capable of holding different data types +- [table2array](table2array.md) - Convert table to homogeneous array. +- [table2cell](table2cell.md) - Convert table to cell array +- [table2struct](table2struct.md) - Convert table to structure array +- [width](width.md) - Number of table variables diff --git a/en/table/SUMMARY.md b/en/table/SUMMARY.md new file mode 100644 index 00000000..2abc2a98 --- /dev/null +++ b/en/table/SUMMARY.md @@ -0,0 +1,12 @@ +- [table](README.md) + - [Accessing and Manipulating Tables in Nelson](accessing_manipulating_table.md) + - [array2table](array2table.md) + - [cell2table](cell2table.md) + - [height](height.md) + - [istable](istable.md) + - [struct2table](struct2table.md) + - [table](table.md) + - [table2array](table2array.md) + - [table2cell](table2cell.md) + - [table2struct](table2struct.md) + - [width](width.md) diff --git a/en/table/accessing_manipulating_table.md b/en/table/accessing_manipulating_table.md new file mode 100644 index 00000000..e2d7d1e5 --- /dev/null +++ b/en/table/accessing_manipulating_table.md @@ -0,0 +1,138 @@ +# Accessing and Manipulating Tables in Nelson + +## Description + +

+ Insertion into a Table +

+

To insert new data into a table, use dot notation or curly braces {} for specific element-wise insertion. You can add new rows, columns, or update existing data.

+

see examples: Adding a New Column and Updating an Existing Element

+

+

+ Extraction from a Table +

+

You can extract specific rows, columns, or individual elements using indexing or by referencing variable names.

+

see examples: Extracting Specific Columns and Extracting Specific Rows

+

+

+ Removing Data from a Table +

+

In Nelson, you can remove rows, columns, or specific elements from a table by using indexing or the removevars function. Rows or columns can be removed by setting the indices to empty brackets [].

+

see examples: Removing Rows and Removing Columns

+

+

+ Horizontal Concatenation (horzcat) +

+

You can concatenate tables horizontally (side by side) using the horzcat function. This function combines tables by appending the columns of one table to the columns of another table.

+

see examples: Horizontal Concatenation

+

+

+ Vertical Concatenation (vertcat) +

+

You can concatenate tables vertically (one below the other) using the vertcat function. This function combines tables by appending the rows of one table to the rows of another table.

+

see examples: Vertical Concatenation

+

+

+ Summary +

+

In Nelson, tables provide a flexible way to store and manipulate heterogeneous data. You can easily insert data, extract parts of the table, and concatenate tables both horizontally and vertically using built-in functionality like dot notation and concatenation functions (horzcat, vertcat), making table manipulation intuitive and powerful for data analysis.

+ +## Examples + +Adding a New Column + +```matlab +T = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}) +% Insert a new column 'Score' +T.Score = [10; 20] +``` + +Updating an Existing Element + +```matlab +T = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}) +% Insert a new column 'Score' +T.Score = [10; 20] +% Update the value in row 1, column 'Score' +T{1, 'Score'} = 15 +``` + +Extracting Specific Columns + +```matlab +T = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}) +% Insert a new column 'Score' +T.Score = [10; 20] +% Update the value in row 1, column 'Score' +T{1, 'Score'} = 15 +% Extract the 'ID' column from the table +ID_column = T.ID +``` + +Extracting Specific Rows + +```matlab +T = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}) +% Insert a new column 'Score' +T.Score = [10; 20] +% Update the value in row 1, column 'Score' +T{1, 'Score'} = 15 +% Extract the first two rows of the table +rows_1_2 = T(1:2, :) +``` + +Removing a Column + +```matlab +T = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}) +% Insert a new column 'Score' +T.Score = [10; 20] +% Remove the 'Score' column from the table +T(:, 'Score') = []; +``` + +Removing a Row + +```matlab +T = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}) +% Insert a new column 'Score' +T.Score = [10; 20] +% Remove the second row from the table +T(2, :) = []; +``` + +Horizontal Concatenation + +```matlab +% Create two tables with the same number of rows +T1 = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}); +T2 = table([10; 20], {'X'; 'Y'}, 'VariableNames', {'Score', 'Grade'}); + +% Concatenate horizontally +T_horz = [T1, T2] % or T_horz = horzcat(T1, T2); +``` + +Vertical Concatenation + +```matlab +T1 = table([1; 2], {'A'; 'B'}, 'VariableNames', {'ID', 'Label'}); +% Create two tables with the same column names +T3 = table([3; 4], {'C'; 'D'}, 'VariableNames', {'ID', 'Label'}); + +% Concatenate vertically +T_vert = [T1; T3] % or T_vert = vertcat(T1, T3) +``` + +## See also + +[table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/array2table.md b/en/table/array2table.md new file mode 100644 index 00000000..537d424b --- /dev/null +++ b/en/table/array2table.md @@ -0,0 +1,42 @@ +# array2table + +Convert homogeneous array to table. + +## Syntax + +- T = array2table(A) + +## Input argument + +- A - matrix: single, double, integer types, logical, char, string, struct, cell. + +## Output argument + +- T - Table object. + +## Description + +

T = array2table(A) converts an m-by-n array A into an m-by-n table, where each column of A becomes a variable in the resulting table T.

+

By default, array2table uses the name of the input array, combined with the column number, to create variable names in the table. If these names are not valid identifiers, it assigns default names of the form 'Var1', 'Var2', ... , 'VarN', where N is the number of columns in A.

+ +## Example + +```matlab +A = magic(6); +T = array2table(A) +T = array2table(magic(6)) +``` + +## See also + +[table2array](table2array.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/cell2table.md b/en/table/cell2table.md new file mode 100644 index 00000000..ed2ef80c --- /dev/null +++ b/en/table/cell2table.md @@ -0,0 +1,44 @@ +# cell2table + +Convert cell array to table. + +## Syntax + +- T = cell2table(C) + +## Input argument + +- C - 2-D cell array. + +## Output argument + +- T - Table object. + +## Description + +

T = cell2table(C) converts the contents of an m-by-n cell array C into an m-by-n table.

+

Each column of the input cell array becomes the data for a corresponding variable in the output table.

+

To generate variable names in the output table, cell2table appends the column numbers to the name of the input array.

+

If the input array does not have a name, cell2table assigns default variable names in the format "Var1", "Var2", ... , "VarN", where N is the number of columns in the cell array.

+ +## Example + +```matlab +C = {'John', 28, true; 'Alice', 35, false; 'Bob', 42, true}; +% Convert the cell array to a table +T = cell2table(C) +``` + +## See also + +[table2cell](table2cell.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/height.md b/en/table/height.md new file mode 100644 index 00000000..521e6c54 --- /dev/null +++ b/en/table/height.md @@ -0,0 +1,44 @@ +# height + +Number of table rows + +## Syntax + +- H = height(T) + +## Input argument + +- T - Input array (table or other). + +## Output argument + +- H - a integer value: Number of table rows in Table or size(T, 1). + +## Description + +

H = height(T) returns the number of rows in the table T.

+

The function height(T) is equivalent to size(T, 1), which also provides the number of rows in the table.

+ +## Example + +```matlab +T = table(); +height(T) +C = {'John', 28, true; 'Alice', 35, false; 'Bob', 42, true}; +T = cell2table(C); +height(T) +``` + +## See also + +[width](width.md), [size](../elementary_functions/size.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/istable.md b/en/table/istable.md new file mode 100644 index 00000000..51b0164c --- /dev/null +++ b/en/table/istable.md @@ -0,0 +1,42 @@ +# istable + +Determine if input is table. + +## Syntax + +- tf = istable(A) + +## Input argument + +- A - Input array. + +## Output argument + +- tf - a logical: true if it is a table. + +## Description + +

tf = istable(A) returns true if A is a table, and false if it is not.

+ +## Example + +```matlab +T = table(); +istable(T) +M = magic(6); +istable(M) +``` + +## See also + +[isa](../types/isa.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/struct2table.md b/en/table/struct2table.md new file mode 100644 index 00000000..dd4b9267 --- /dev/null +++ b/en/table/struct2table.md @@ -0,0 +1,76 @@ +# struct2table + +Convert a structure array into a tabular format. + +## Syntax + +- T = struct2table(S) + +## Input argument + +- S - structure: Array provided as a structure. + +## Output argument + +- T - A table object. + +## Description + +

T = struct2table(S) transforms a structure array into a table, where each field of the input structure is represented as a variable in the resulting table.

+

If the input is a scalar structure containing 𝑛 fields, each with 𝑚 rows, the output will be an 𝑚×𝑛 table.

+

If the input is either an 𝑚×1 or a 1×𝑚 structure array with 𝑛 fields, the output will also be an 𝑚×𝑛 table.

+ +## Examples + +```matlab +% Define a structure array +S(1).Name = 'Alice'; +S(1).Age = 30; +S(1).Height = 5.5; + +S(2).Name = 'Bob'; +S(2).Age = 25; +S(2).Height = 6.0; + +% Convert the structure array to a table +T = struct2table(S) +``` + +```matlab +S = struct(); +S(1).a = [10 20]; +S(2).a = [30 40]; +S(1).b = 50; +S(2).b = 60; +T = struct2table(S) +``` + +```matlab +S = struct(); +S.a = [1;2;3] +S.b = [4 5;6 7;8 9] +T = struct2table(S) +``` + +```matlab +S = struct(); +S(1).a = [10 20]; +S(2).a = [30 40 50]; +S(1).b = 70; +S(2).b = 80; +T = struct2table(S) +``` + +## See also + +[table2struct](table2struct.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/table.md b/en/table/table.md new file mode 100644 index 00000000..bd2bd5d6 --- /dev/null +++ b/en/table/table.md @@ -0,0 +1,93 @@ +# table + +A table-like array with named variables, capable of holding different data types + +## Syntax + +- T = table() +- T = table(var1, ... , varN) +- T = table(... , Name, Value) + +## Input argument + +- var1, ... , varN - Input variables: Input variables are specified as arrays that all have the same number of rows. These variables can differ in size and data type. +- Name, Value - Optional arguments are specified as pairs in the format Name1, Value1, ... , NameN, ValueN, where Name represents the argument name and Value is its corresponding value. These name-value pairs must come after any other arguments, but the order of the pairs themselves is flexible + +## Output argument + +- T - A table object. + +## Description + +

Table arrays are designed to store column-oriented, such as columns from text files or spreadsheets.

+

Each column of data is stored in a variable within the table, and these variables can have different data types and sizes, provided they all share the same number of rows.

+

Table variables have names, similar to structure fields.

+

+

To access data in a table, use the following methods:

+

+

- Dot notation (T.varname) to extract a single variable.

+

- Curly braces (T{rows, vars}) to extract an array from specific rows and variables.

+

- Parentheses (T(rows, vars)) to return a subset of the table.

+

+

T = table(var1, ..., varN) creates a table from the specified input variables var1,...,varN.

+

The variables can vary in size and data type, but they must all have the same number of rows.

+

If the inputs are workspace variables, their names are used as the variable names in the resulting table.

+

Otherwise, the table assigns default names in the format 'Var1', 'Var2', and so on, where N is the total number of variables.

+

+

T = table(..., Name, Value) allows you to specify additional options using one or more name-value pair arguments.

+

For instance, you can set custom variable names by using the 'VariableNames' name-value pair.

+

This syntax can be used in combination with any of the input arguments from the previous forms.

+

+

T = table() creates an empty table with 0 rows and 0 columns.

+ +## Examples + +```matlab +Names = {'John'; 'Alice'; 'Bob'; 'Diana'}; +Age = [28; 34; 22; 30]; +Height = [175; 160; 180; 165]; +Weight = [70; 55; 80; 60]; +T = table(Names, Age, Height, Weight) +T.Names +T{2, 2} +T{'Alice', 'Age'} +T{2, 'Age'} +T(:, 'Age') +T(2:3,1:3) +``` + +```matlab +N = {'John'; 'Alice'; 'Bob'; 'Diana'}; +A = [28; 34; 22; 30]; +H = [175; 160; 180; 165]; +W = [70; 55; 80; 60]; +T = table(N, A, H, W, 'VariableNames', {'Name', 'Age', 'Height', 'Weight'}) +``` + +```matlab +N = {'John'; 'Alice'; 'Bob'; 'Diana'}; +A = [28; 34; 22; 30]; +H = [175; 160; 180; 165]; +W = [70; 55; 80; 60]; + +% Define the row names +RowNames = {'Person1', 'Person2', 'Person3', 'Person4'}; + +% Create the table with row names +T = table(A, H, W, 'RowNames', RowNames, 'VariableNames', {'Age', 'Height_cm', 'Weight_kg'}) +T('Person2', 1:2) +``` + +## See also + +[Accessing and Manipulating Tables in Nelson](accessing_manipulating_table.md), [cell2table](cell2table.md), [array2table](array2table.md), [struct2table](struct2table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/table2array.md b/en/table/table2array.md new file mode 100644 index 00000000..1e11c777 --- /dev/null +++ b/en/table/table2array.md @@ -0,0 +1,43 @@ +# table2array + +Convert table to homogeneous array. + +## Syntax + +- A = table2array(T) + +## Input argument + +- T - table object. + +## Output argument + +- A - matrix: single, double, integer types, logical, char, string, struct, cell. + +## Description + +

A = table2array(T) converts the input table T into a homogeneous array A, where the variables in T become the columns of A.

+

The output A does not retain the table properties from T.Properties.

+

If T is a table with row names, these row names will not be included in A.

+ +## Example + +```matlab +A = magic(6); +T = array2table(A); +A = table2array(T) +``` + +## See also + +[array2table](array2table.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/table2cell.md b/en/table/table2cell.md new file mode 100644 index 00000000..d8475106 --- /dev/null +++ b/en/table/table2cell.md @@ -0,0 +1,46 @@ +# table2cell + +Convert table to cell array + +## Syntax + +- S = table2cell(T) +- S = table2cell(T, "ToScalar", true) + +## Input argument + +- T - a table object + +## Output argument + +- C - Cell array. + +## Description + +

C = table2cell(T) converts the table T into a cell array C, where each variable in T is transformed into a column of cells in C.

+

The output C does not include any properties from T.Properties.

+

If T contains row names, these will not be included in C.

+ +## Example + +```matlab +S = ["Y";"Y";"N";"N";"N"]; +A = [38;43;38;40;49]; +B = [124 93;109 77; 125 83; 117 75; 122 80]; +T = table(S, A, B, 'VariableNames',["Smoker" "Age" "BloodPressure"], 'RowNames',["Chang" "Brown" "Ruiz" "Lee" "Garcia"]) +C = table2cell(T) +``` + +## See also + +[cell2table](cell2table.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/table2struct.md b/en/table/table2struct.md new file mode 100644 index 00000000..5638805a --- /dev/null +++ b/en/table/table2struct.md @@ -0,0 +1,50 @@ +# table2struct + +Convert table to structure array + +## Syntax + +- S = table2struct(T) +- S = table2struct(T, "ToScalar", true) + +## Input argument + +- T - a table object + +## Output argument + +- S - Structure. + +## Description + +

S = table2struct(T) converts the table T into a structure array S, where each variable in T is represented as a field in S.

+

If T is an m-by-n table, S will be an m-by-1 structure array with n fields.

+

the output S will not contain any table properties from T.Properties.

+

S = table2struct(T, "ToScalar", true) converts the table T into a scalar structure S, where each variable in T becomes a field in S.

+

If T is an m-by-n table, S will contain n fields, and each field will have m rows.

+ +## Example + +```matlab +Names = {'John'; 'Alice'; 'Bob'; 'Diana'}; +Age = [28; 34; 22; 30]; +Height = [175; 160; 180; 165]; +Weight = [70; 55; 80; 60]; +T = table(Names, Age, Height, Weight) +S1 = table2struct(T) +S1 = table2struct(T, "ToScalar", true) +``` + +## See also + +[struct2table](struct2table.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/table/width.md b/en/table/width.md new file mode 100644 index 00000000..fb5b659b --- /dev/null +++ b/en/table/width.md @@ -0,0 +1,44 @@ +# width + +Number of table variables + +## Syntax + +- W = width(T) + +## Input argument + +- T - Input array (table or other). + +## Output argument + +- W - a integer value: Number of Variables in Table or size(T, 2). + +## Description + +

W = width(T) returns the number of variables in the table T.

+

The function width(T) is equivalent to size(T, 2), which also provides the number of columns in the table.

+ +## Example + +```matlab +T = table(); +width(T) +C = {'John', 28, true; 'Alice', 35, false; 'Bob', 42, true}; +T = cell2table(C); +width(T) +``` + +## See also + +[height](height.md), [size](../elementary_functions/size.md), [table](table.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/en/time/README.md b/en/time/README.md index aac44640..d5dce2ea 100644 --- a/en/time/README.md +++ b/en/time/README.md @@ -12,6 +12,7 @@ time functions - [cputime](cputime.md) - Return the CPU time used by your Nelon session. - [date](date.md) - Return the Current date as character vector. - [datenum](datenum.md) - Return the date/time input as a serial day number. +- [datestr](datestr.md) - Convert date and time to string format. - [datevec](datevec.md) - Convert a serial date number into a date vector. - [eomday](eomday.md) - Returns last day of month. - [etime](etime.md) - Time elapsed between date vectors. diff --git a/en/time/SUMMARY.md b/en/time/SUMMARY.md index 741e19ee..2b8f67a3 100644 --- a/en/time/SUMMARY.md +++ b/en/time/SUMMARY.md @@ -5,6 +5,7 @@ - [cputime](cputime.md) - [date](date.md) - [datenum](datenum.md) + - [datestr](datestr.md) - [datevec](datevec.md) - [eomday](eomday.md) - [etime](etime.md) diff --git a/en/time/datenum.md b/en/time/datenum.md index 8c3264bc..2b57b9b3 100644 --- a/en/time/datenum.md +++ b/en/time/datenum.md @@ -7,6 +7,8 @@ Return the date/time input as a serial day number. - d = datetnum(datevec) - d = datenum(datestr) - d = datenum(datestr, format) +- d = datenum(datestr, pivotYear) +- d = datenum(DateString,format,pivotYear) - d = datetnum(Y, M, D) - d = datetnum(Y, M, D, H, MN, S) @@ -16,6 +18,7 @@ Return the date/time input as a serial day number. - format - a string: date format. - datestr - a string, cell of string or string array: text representing a date. - Y, M, D, H, MN, S - double: Year, Month, Day, Hours, Minutes, Secondes (scalar or vector). +- pivotYear: Start year of 100-year date range - integer value or present minus 50 years (default). ## Output argument @@ -26,6 +29,7 @@ Return the date/time input as a serial day number.

d = datenum() returns the serial date number corresponding to current date.

d = datenum(datevec) converts date vector to serial date number.

d = datenum(datestr) and d = datenum(datestr, format) converts string to serial date number.

+

Supported format conversion:

dd-mmm-yyyy HH:MM:SS 10-Mar-2010 16:48:17

dd-mmm-yyyy 10-Mar-2010

@@ -41,6 +45,99 @@ Return the date/time input as a serial day number.

HH:MM:SS PM 3:48:17 PM

HH:MM 16:48

HH:MM PM 3:35 PM

+

+

If format is not specified, the default format is dd-mmm-yyyy.

+

+

If format is specified and not using predefined format, the format must be specified as a character vector or string scalar composed of symbolic identifiers.

+

The format of the input text for representing dates and times, expressed as a character vector or string scalar composed of symbolic identifiers.

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Symbolic IdentifierDescriptionExample
yyyyYear in full1995, 2012
yyYear in two digits89, 01
QQQuarter year using letter Q and one digitQ1
mmmmMonth using full nameMarch, December
mmmMonth using first three lettersMar, Dec
mmMonth in two digits04, 12
mMonth using capitalized first letterM, D
ddddDay using full nameMonday, Tuesday
dddDay using first three lettersMon, Tue
ddDay in two digits06, 21
dDay using capitalized first letterM, T
HHHour in two digits (no leading zeros when symbolic identifier AM or PM is used)06, 6 AM
MMMinute in two digits11, 01
SSSecond in two digits06, 59
FFFMillisecond in three digits056
AM or PMAM or PM inserted in text representing time5:46:02 PM
## Example @@ -57,9 +154,10 @@ d = datenum(["04–Aug-1973 12:01:18"; "04–Aug-1974 11:01:18"]) ## History -| Version | Description | -| ------- | --------------- | -| 1.0.0 | initial version | +| Version | Description | +| ------- | ----------------------------- | +| 1.0.0 | initial version | +| 1.8.0 | date string parsing extended. | ## Author diff --git a/en/time/datestr.md b/en/time/datestr.md new file mode 100644 index 00000000..cfb4f1a6 --- /dev/null +++ b/en/time/datestr.md @@ -0,0 +1,200 @@ +# datestr + +Convert date and time to string format. + +## Syntax + +- dateAsString = datestr(dateVector) +- dateAsString = datestr(dateNumber) +- dateAsString = datestr(..., formatOut) +- dateAsString = datestr(dateAsStringIn) +- dateAsString = datestr(dateAsStringIn, formatOut, pivotYear) +- dateAsString = datestr(..., 'local') + +## Input argument + +- dateVector - Date vectors or matrix. +- dateNumber - Serial date numbers: An array of positive double-precision floating-point numbers. +- formatOut - character vector, string scalar or integer value (-1 default): Output format for representing dates and times +- dateAsStringIn - character vector, cell array or string array: text denoting dates and times to convert. +- pivotYear - integer value: present minus 50 years (default). +- 'local' - returns the date in the language of the current locale. + +## Output argument + +- dateAsString - character vector or two-dimensional character array: text denoting dates and time. + +## Description + +

dateAsString = datestr(dateVector) converts date vectors into text that represents the corresponding dates and times. It returns a character array with m rows, where m is the number of date vectors in dateVector.

+

dateAsString = datestr(dateNumber) converts serial date numbers into text representing dates and times. The output is a character array with m rows, where m is the number of date numbers in dateNumber.

+

dateAsString = datestr(..., formatOut) allows you to specify the format of the output text using formatOut. You can apply this option with any of the previous input types.

+

dateAsString = datestr(dateAsStringIn) converts the input string dateAsStringIn into a text format of day-month-year hour:minute:second. All dates in dateAsStringIn must follow the same format.

+

dateAsString = datestr(dateAsStringIn, formatOut, pivotYear) converts dateAsStringIn into the format specified by formatOut, while using an optional pivotYear to interpret two-digit years.

+

dateAsString = datestr(..., 'local') returns the date in the language of the system's current locale. If 'local' is omitted, the default language is US English. The 'local' option can be used with any of the previous syntaxes, and must be the last argument in the sequence.

+

+

Supported format conversion:

+

dd-mmm-yyyy HH:MM:SS 10-Mar-2010 16:48:17

+

dd-mmm-yyyy 10-Mar-2010

+

mm/dd/yyyy 03/10/2010

+

mm/dd/yy 03/10/00

+

mm/dd 03/10

+

mmm.dd,yyyy HH:MM:SS Mar.10,2010 16:48:17

+

mmm.dd,yyyy Mar.10,2010

+

yyyy-mm-dd HH:MM:SS 2010-03-10 16:48:17

+

yyyy-mm-dd 2010-03-10

+

yyyy/mm/dd 2000/03/10

+

HH:MM:SS 16:48:17

+

HH:MM:SS PM 3:48:17 PM

+

HH:MM 16:48

+

HH:MM PM 3:35 PM

+

+

If format is not specified, the default format is dd-mmm-yyyy.

+

+

If format is specified and not using predefined format, the format must be specified as a character vector or string scalar composed of symbolic identifiers.

+

The format of the input text for representing dates and times, expressed as a character vector or string scalar composed of symbolic identifiers.

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Symbolic IdentifierDescriptionExample
yyyyYear in full1995, 2012
yyYear in two digits89, 01
QQQuarter year using letter Q and one digitQ1
mmmmMonth using full nameMarch, December
mmmMonth using first three lettersMar, Dec
mmMonth in two digits04, 12
mMonth using capitalized first letterM, D
ddddDay using full nameMonday, Tuesday
dddDay using first three lettersMon, Tue
ddDay in two digits06, 21
dDay using capitalized first letterM, T
HHHour in two digits (no leading zeros when symbolic identifier AM or PM is used)06, 6 AM
MMMinute in two digits11, 01
SSSecond in two digits06, 59
FFFMillisecond in three digits056
AM or PMAM or PM inserted in text representing time5:46:02 PM
+ +## Examples + +```matlab +dateVector = [2019, 4, 2, 9, 7, 18]; +datestr(dateVector) +``` + +```matlab +dateVector = [2019, 4, 2, 9, 7, 18]; +formatOut = 'mm/dd/yy'; +datestr(dateVector, formatOut) +``` + +```matlab +datestr(now, 'mmmm dd, yyyy HH:MM:SS.FFF AM') +``` + +```matlab +datestr('06:33 PM','HH:MM') +``` + +```matlab +datestr('06:33','HH:MM PM') +``` + +```matlab +formatOut = 'dd mmm yyyy'; +datestr(datenum('18-05-45','dd-mm-yy',1900),formatOut) +``` + +```matlab +datestr(datenum({'09/17/2017';'06/14/1906';'10/29/2014'}, 'mm/dd/yyyy'))) +``` + +```matlab +dateStringIn = '5/17/56'; +formatOut = 1; +pivotYear = 1900; +datestr(dateStringIn, formatOut, pivotYear) +pivotYear = 2000; +datestr(dateStringIn,formatOut, pivotYear) +``` + +## See also + +[datenum](datenum.md), [datevec](datevec.md). + +## History + +| Version | Description | +| ------- | --------------- | +| 1.8.0 | initial version | + +## Author + +Allan CORNET diff --git a/fr/README.md b/fr/README.md index b2f816ab..265d0ab3 100644 --- a/fr/README.md +++ b/fr/README.md @@ -1,9 +1,84 @@ ![banner](banner_homepage.png) -### Nelson 1.7.0.0 +### Nelson 1.8.0.0 -Nelson est un environnement interactif et entièrement fonctionnel pour les applications techniques et scientifiques. Il implémente un langage matriciel (qui est largement compatible avec MATLAB et GNU Octave), avec des fonctionnalités avancées telles que le traçage 2D 3D, la manipulation et la visualisation d'images, une interface sans code vers des bibliothèques externes C/C++/FORTRAN, une interface native prise en charge de divers types C et d'une foule d'autres fonctionnalités. -Essayez-le ! +**Nelson** est un langage de calcul numérique puissant et open-source, conçu pour offrir un environnement complet et intuitif aux ingénieurs, scientifiques et étudiants. Avec plus de 1 200 fonctions intégrées, Nelson prend en charge une large gamme de tâches, allant de l'algèbre de base aux simulations numériques avancées. + +Initialement inspiré par des langages comme MATLAB© et Gnu Octave, Nelson offre aux utilisateurs une expérience légère mais riche en fonctionnalités. Il est conçu pour être facile à apprendre et à utiliser, avec un accent particulier sur la performance et la flexibilité. + +**Essayez-le !** + +[Site Web](https://nelson-lang.github.io/nelson-website/) + +## Fonctionnalités + +### Types de données gérés par Nelson + +- **Double et Complexe Double** : Prend en charge les scalaires, les vecteurs, les matrices 2D, les tableaux N-dimensionnels et les matrices creuses. +- **Simple et Complexe Simple** : Inclut les scalaires, les vecteurs, les matrices 2D, les tableaux N-dimensionnels et les matrices creuses. +- **Logique** : Gère les scalaires, les vecteurs, les matrices 2D, les tableaux N-dimensionnels et les matrices creuses. +- **Tableaux de caractères** : Prend en charge les caractères UNICODE. +- **Tableaux de chaînes** : Prend en charge pleinement UNICODE. +- **Entiers** : Scalaires signés et non signés 8, 16, 32 et 64 bits, vecteurs, matrices 2D et tableaux N-dimensionnels. +- **Objets Handle** : Pour la fonctionnalité orientée objet. +- **Fonctions anonymes** : Permet la création et la manipulation de fonctions sans nom. +- **Structures de données** : Prend en charge les dictionnaires et les tableaux. +- **Surcharge** : Tous les types peuvent être surchargés pour un comportement personnalisé. + +### Améliorations de la performance + +- **OpenMP et SIMD** : Utilise le traitement parallèle et la vectorisation pour des calculs plus rapides. + +### Visualisation & Interface + +- **Graphiques 2D et 3D** : Commandes de haut niveau pour la visualisation. +- **Contrôles d'interface utilisateur** : Contrôles intégrés pour créer des interfaces personnalisées. +- **Environnement de bureau** : Suivi de l'historique, explorateur de fichiers et navigateur de l'espace de travail. + +### Modules avancés + +- **Calcul parallèle** : Permet une utilisation efficace des processeurs multi-cœurs. +- **Transformée de Fourier rapide (FFT)** : Fonctions FFT haute performance basées sur FFTW et MKL. +- **Interface SLICOT** : Support optionnel pour la bibliothèque de sous-programmes en théorie des systèmes et du contrôle. +- **Module Système de contrôle** : Outils pour la théorie du contrôle et la conception de systèmes. +- **MPI (Interface de passage de messages)** : Fonctions pour le calcul parallèle distribué. + +### Formats de données & Interface + +- **Support JSON** : Lecture et écriture de fichiers JSON. +- **Fonctions HDF5** : Fonctions I/O de haut niveau, avec HDF5 comme format de fichier par défaut pour les espaces de travail `.nh5`. +- **Compatibilité MAT-File** : Chargement et sauvegarde des espaces de travail au format MAT-file. +- **Interface de fonction étrangère (FFI)** : Construction et chargement dynamique de code C/Fortran. +- **Compatibilité API MEX C** : Interface avec les API C compatibles MEX. +- **API Nelson Engine** : Utilisation de Nelson comme moteur en arrière-plan dans le code C, compatible avec l'API MEX Engine. +- **Interface Python** : Appel de scripts et fonctions Python depuis Nelson. +- **API RESTful** : Permet à Nelson d'interagir avec des services web. + +### Fonctionnalités supplémentaires + +- **Communication inter-processus** : Communication entre les processus Nelson. +- **Moteur QML** : Utilisation du framework QML de Qt pour afficher et manipuler du contenu graphique. +- **Component Object Model (COM)** : Interface avec les composants COM, notamment sous Windows. +- **Support des fichiers Excel** : Lecture et écriture de fichiers `.xlsx` via COM sous Windows. +- **Éditeur de code intégré** : Éditeur intégré pour les scripts Nelson. + +### Outils d'aide et de test + +- **Moteur d'aide** : Génération et visualisation des fichiers d'aide dans divers formats comme HTML, Markdown, PDF ou GitBook. +- **Moteur de test** : Validation des algorithmes avec des fonctions intégrées, avec export des rapports xUnit. + +### Profilage & Couverture de code + +- **Profileur** : Profileur intégré pour analyser et optimiser la performance du code. +- **Couverture de code** : Mesure de la couverture des tests pour garantir une validation complète. + +### Cloud & Extensibilité + +- **Nelson Cloud** : Accès instantané à Nelson depuis n'importe quel navigateur web via [Nelson Cloud](https://www.npmjs.com/package/nelson-cloud). +- **Module Skeleton** : Modèles pour étendre Nelson : + - [Template avec Macros et Builtins](https://github.com/nelson-lang/module_skeleton). + - [Template de Macros de Base](https://github.com/nelson-lang/module_skeleton_basic). +- **Nelson Modules Manager (nmm)** : Un gestionnaire de paquets pour installer et gérer les extensions de Nelson. --- diff --git a/fr/changelogs/CHANGELOG.md b/fr/changelogs/CHANGELOG.md index 6f05aa48..e2abdf87 100644 --- a/fr/changelogs/CHANGELOG.md +++ b/fr/changelogs/CHANGELOG.md @@ -5,7 +5,51 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 1.7.0 (2024-08-27) +## UNRELEASED + +### Added + +- **`table` Data Type**: + + - Introduced the `table` data type, offering enhanced functionality for structured data manipulation. + + - Overloaded methods specific to the `table` data type: + + - `disp`, `display` for table display. + - `horzcat`, `vertcat` for horizontal and vertical concatenation. + - `isempty` to check if the table is empty. + - `isequal`, `isequalto` for table comparison. + - `properties` for accessing table metadata. + - `subsasgn` for subscripted assignment. + - `subsref` for subscripted referencing. + + - Conversion functions added: + + - `array2table`: Convert an array to a table. + - `cell2table`: Convert a cell array to a table. + - `struct2table`: Convert a structure to a table. + - `table2array`: Convert a table to an array. + - `table2cell`: Convert a table to a cell array. + - `table2struct`: Convert a table to a structure. + + - Utility functions introduced: + - `width`: Retrieve the number of columns in the table + - `height`: Retrieve the number of rows in the table + - `istable`: Check if a variable is of the `table` data type + +- `Resize` - Resize figure property. +- [#36](http://github.com/nelson-lang/nelson/issues/36) `datenum` format compatibility extended. +- [#37](http://github.com/nelson-lang/nelson/issues/37) `datestr` Convert date and time to string format. + +### Changed + +- CodeQL Github action updated. + +### Fixed + +- fix 'units' refresh for 'axes' object. + +## 1.7.0 (2024-08-28) ### Added diff --git a/package.json b/package.json index c2b78a1e..173fa9e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nelson-gitbook", - "version": "1.5.0", + "version": "1.8.0", "description": "Nelson, an array programming language - gitbook", "copyright": "Copyright 2018-present Allan CORNET", "scripts": { @@ -10,7 +10,7 @@ "prettier:check:standard": "prettier --check \"**/*.{js,json,yml,md}\"" }, "devDependencies": { - "prettier": "2.7.1", + "prettier": "3.3.3", "npm-run-all": "4.1.5" } }