Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
MATLAB (Matrix Laboratory) is a programming platform for numerical computing, signal processing, control systems, and data analysis. It is widely used in engineering, physics, finance, and academia.
>> x = [1, 2, 3, 4, 5];
>> mean(x)
ans = 3
A 2D array of numbers. All elements must be numeric.
A = [1, 2, 3; 4, 5, 6; 7, 8, 9];
% Access
A(1, 2) % = 2
A(:, 1) % = [1; 4; 7]
size(A) % = [3, 3]
A container where each cell can hold any data type. Ideal for mixed-type tabular data from CSV.
C = {'Alice', 30, 'New York'; 'Bob', 25, 'London'; 'Charlie', 35, 'Tokyo'};
% Access with curly braces for content
C{1, 1} % = 'Alice'
C{2, 3} % = 'London'
An array of structures with named fields.
S(1).name = 'Alice';
S(1).age = 30;
S(1).city = 'New York';
S(2).name = 'Bob';
S(2).age = 25;
S(2).city = 'London';
A tabular data structure with column names — closest to a spreadsheet.
T = table(...
{'Alice'; 'Bob'; 'Charlie'}, ...
[30; 25; 35], ...
{'New York'; 'London'; 'Tokyo'}, ...
'VariableNames', {'name', 'age', 'city'});
% Access
T.name % column as array
T{1, 2} % cell access
T.age > 28 % logical indexing
| Type | Best For | Mixed Types | Named Columns |
|---|---|---|---|
| Matrix | Pure numeric data | No | No |
| Cell array | Mixed data, quick prototyping | Yes | No |
| Struct array | Record-style data with named fields | Yes | Yes (field names) |
| Table | Spreadsheet-like data, analysis | Yes | Yes |
A = readmatrix('data.csv');C = readcell('data.csv');T = readtable('data.csv');| Aspect | readmatrix/readcell/readtable |
|---|---|
| When to use | Dynamic CSV files at runtime |
| Requires | File path at runtime |
| Flexibility | Handles any CSV |
| Dependencies | CSV file must be present |
| Aspect | This Tool |
|---|---|
| When to use | Static data, testing, homework, prototypes |
| Output | Self-contained MATLAB code |
| Flexibility | Editable MATLAB source |
| Dependencies | None at runtime — data is literal code |
| Use Case | Description |
|---|---|
| Homework | Embed sample datasets directly in MATLAB scripts |
| Testing | Create test arrays for unit tests |
| Signal processing | Hardcode sensor data as MATLAB arrays |
| Prototyping | Test algorithms with real data without file I/O |
| MATLAB Live Scripts | Include data inline in .mlx documents |
| Simulink models | Define lookup table data in model callbacks |
| Presentations | Share self-contained MATLAB demos |
| Data cleaning | Use the table editor to clean CSV before generating code |
| Control systems | Define plant model parameters from experimental CSV data |
| Machine learning | Hardcode training/test splits for reproducibility |
After loading CSV data, an interactive spreadsheet grid lets you edit before converting:
| Operation | Description |
|---|---|
| Undo / Redo | Full edit history support |
| Add Row / Column | Insert new rows and columns |
| Delete Selected | Remove selected rows or columns |
| Transpose | Swap rows and columns |
| Clear | Remove all data |
| Delete Empty | Remove empty rows/columns |
| Deduplicate | Remove duplicate rows |
| Replace | Find and replace (with regex support) |
| Case transform | UPPERCASE, lowercase, Title Case |
| Insert/delete | Right-click for row/column operations |
| First Row as Header | Toggle header treatment |
| Keyboard navigation | Arrow keys, Tab, Enter for cell navigation |
All processing runs entirely in your browser. No CSV data is uploaded to any server.
Choose one of two input methods:
Upload a file: Drag a .csv or .tsv file onto the upload area, or click to browse.
Paste data: Click "Enter Data" to switch to the code editor. Paste your CSV.
Use the toolbar to clean your data before converting.
Toggle ON if the first row contains column headers.
Click Convert. The MATLAB code appears in the "Output Data" panel.
Click Copy to Clipboard to paste into your .m file.
Premium users can click Download File to save.
Input CSV:
sensor_id,temperature,humidity,pressure
SENS-01,22.5,45.2,1013.25
SENS-02,18.3,62.1,1015.50
SENS-03,25.0,38.7,1012.00
SENS-04,20.1,55.3,1014.75
Output (Cell Array):
data = {
'SENS-01', 22.5, 45.2, 1013.25;
'SENS-02', 18.3, 62.1, 1015.50;
'SENS-03', 25.0, 38.7, 1012.00;
'SENS-04', 20.1, 55.3, 1014.75;
};
Input CSV:
1.0,2.0,3.04.0,5.0,6.07.0,8.0,9.0Output:
data = [1.0, 2.0, 3.0; 4.0, 5.0, 6.0; 7.0, 8.0, 9.0];Input CSV:
Name,Math,Physics,Chemistry
Alice,92,88,95
Bob,78,82,71
Charlie,95,91,89
Diana,88,76,93
Output:
data = {
'Alice', 92, 88, 95;
'Bob', 78, 82, 71;
'Charlie', 95, 91, 89;
'Diana', 88, 76, 93;
};
% Access
data{1, 1} % First cell content
data(1, :) % First row as cell array
data(:, 2) % Second column as cell array
% Extract numeric column
temps = [data{:, 2}] % Vertical concatenation to vector
mean(temps) % Average temperature
% Filter
idx = cellfun(@(x) x > 20, [data{:, 2}]);
hot_sensors = data(idx, :);
% Convert to matrix (numeric columns only)
numeric_cols = cell2mat(data(:, 2:4));
T = cell2table(data, 'VariableNames', ...
{'sensor_id', 'temperature', 'humidity', 'pressure'});
[nrows, ~] = size(data);
for i = 1:nrows
S(i).sensor_id = data{i, 1};
S(i).temperature = data{i, 2};
S(i).humidity = data{i, 3};
S(i).pressure = data{i, 4};
end
| Feature | Matrix [] | Cell Array {} |
|---|---|---|
| Declaration | A = [1, 2; 3, 4] | C = {'a', 1; 'b', 2} |
| Row separator | ; | ; |
| Column separator | , or space | , or space |
| Element access | A(1,2) | C{1,2} |
| Type constraint | All numeric | Any type per cell |
| Best for | Numbers, math | Mixed data, strings |
| CSV Value | MATLAB Output | Example |
|---|---|---|
42 | Numeric | 42 |
3.14 | Numeric | 3.14 |
hello | String | 'hello' |
true | String | 'true' |
| Empty cell | Empty string | '' |
| Function | Purpose | Example |
|---|---|---|
size(A) | Dimensions | size(A) → [3, 4] |
length(A) | Longest dimension | length(A) → 4 |
numel(A) | Total elements | numel(A) → 12 |
A(i, j) | Matrix index | A(2, 3) |
C{i, j} | Cell content | C{1, 2} |
A(:, k) | k-th column | A(:, 1) |
A(k, :) | k-th row | A(1, :) |
A' | Transpose | A' |
reshape(A, m, n) | Reshape | reshape(A, 2, 6) |
sort(A) | Sort | sort(A) |
max(A) | Maximum | max(A) |
min(A) | Minimum | min(A) |
mean(A) | Mean | mean(A) |
sum(A) | Sum | sum(A) |
find(A > 0) | Find indices | find(A > 0) |
cell2mat(C) | Cell to matrix | cell2mat(C) |
cell2table(C) | Cell to table | cell2table(C) |
num2str(n) | Number to string | num2str(42) |
str2num(s) | String to number | str2num('42') |
disp(A) | Display | disp(A) |
| Field | Use Case |
|---|---|
| Signal processing | Filter design, FFT, spectral analysis |
| Control systems | PID tuning, state-space models, Bode plots |
| Image processing | Filtering, segmentation, feature extraction |
| Communications | Modulation, BER analysis, channel modeling |
| Finance | Risk analysis, portfolio optimization, Monte Carlo |
| Automotive | ADAS algorithms, powertrain modeling |
| Aerospace | Flight dynamics, navigation, orbit mechanics |
| Robotics | Kinematics, path planning, sensor fusion |
| Biomedical | ECG/EEG analysis, medical imaging |
| Academia | Research, teaching, homework assignments |
No. All conversion happens locally in your browser using JavaScript. Your CSV data never leaves your device.
For mixed-type data (strings and numbers), the tool generates a cell array using {} syntax. For pure numeric data, it generates a matrix using [] syntax.
[] and {} in MATLAB? [] creates a matrix (all elements must be numeric). {} creates a cell array (each cell can hold any type). Use matrices for math; use cell arrays for mixed data.
() and {} for indexing? A(i, j) accesses a matrix element by position. C{i, j} accesses a cell's content. C(i, j) returns a cell (not its content).
Yes. Paste the generated code directly into a MATLAB Live Script (.mlx) code block.
readmatrix() reads CSV files at runtime from disk. This tool generates MATLAB source code with hardcoded array literals. Use this for static data, testing, and demos; use readmatrix() for dynamic data.
readtable() imports CSV as a table with named columns. readcell() imports as a cell array. Both require the file at runtime. This tool generates standalone code that works without any file.
Yes. The built-in table editor lets you modify cells, transpose, deduplicate, find/replace, change case, and insert/delete rows and columns.
Standard CSV (.csv) and TSV (.tsv) files with comma or tab delimiters.
The tool processes data entirely in your browser. Files up to 10 MB typically convert without issues on modern hardware.
Yes. The tool is responsive, though the table editor is best experienced on desktop.