MediaWiki to MATLAB Converter

Transform MediaWiki tables into MATLAB data structures including matrices, cell arrays, tables, and structs

MediaWiki Input

MATLAB Output

About MediaWiki to MATLAB Converter

Convert MediaWiki table markup to MATLAB data structures including numeric matrices, cell arrays, tables, and struct arrays. Perfect for importing wiki data into MATLAB for analysis, visualization, and computation.

Key Features

  • Multiple Formats: Cell array, numeric matrix, MATLAB table, and struct array
  • Automatic Type Detection: Identifies numeric vs. string data
  • Header Support: Includes headers in appropriate formats
  • String Escaping: Properly escapes single quotes in strings
  • Valid Identifiers: Generates valid MATLAB variable and field names
  • MediaWiki Parser: Accurately parses MediaWiki table syntax
  • File Upload: Upload .wiki files directly
  • Copy & Download: Easy export to .m files

How to Use

  1. Input MediaWiki Table: Paste your MediaWiki table markup or upload a .wiki file
  2. Configure Options: Choose output format and header preferences
  3. Review Output: The MATLAB code generates automatically
  4. Copy to MATLAB: Use the Copy button and paste into MATLAB editor
  5. Run in MATLAB: Execute the code to create the data structure

Output Format Options

  • Cell Array: Universal format supporting mixed data types (strings and numbers)
  • Numeric Matrix: For purely numeric data, creates a standard MATLAB matrix
  • MATLAB Table: Modern table format with named columns (requires R2013b or later)
  • Struct Array: Array of structures with named fields

Example Conversion

MediaWiki Input:

{| class="wikitable" border="1"
! Name !! Age !! Salary
|-
| John Doe || 28 || 75000
|-
| Jane Smith || 34 || 85000
|}

MATLAB Output (Cell Array):

% Cell array with data
data = {
    'Name', 'Age', 'Salary'
    'John Doe', 28, 75000
    'Jane Smith', 34, 85000
};

MATLAB Output (Table):

% MATLAB table (requires R2013b or later)
data = table({'John Doe'; 'Jane Smith'}, [28; 34], [75000; 85000], ...
    'VariableNames', {'Name', 'Age', 'Salary'});

Common Use Cases

  • Data Analysis: Import wiki datasets for statistical analysis
  • Scientific Computing: Load experimental data from wikis
  • Visualization: Create plots and charts from wiki tables
  • Machine Learning: Prepare training data from wiki sources
  • Simulation: Use wiki parameters in MATLAB simulations
  • Research: Import published data tables for reproduction studies

Cell Array Format

Most versatile format supporting mixed data types:

  • Handles both strings and numbers
  • Works with all MATLAB versions
  • Easy to access with indexing: data{row, col}
  • Can include headers as first row

Numeric Matrix Format

Efficient format for purely numeric data:

  • Standard MATLAB matrix (2D array)
  • Fast computation and memory efficient
  • Access with indexing: data(row, col)
  • Automatically falls back to cell array if non-numeric data detected

MATLAB Table Format

Modern format with named columns (R2013b+):

  • Column names from headers
  • Access by name: data.ColumnName
  • Supports mixed data types per column
  • Integrates with MATLAB's table functions
  • Best for data analysis and statistics

Struct Array Format

Array of structures with named fields:

  • Field names from headers
  • Access with dot notation: data(idx).fieldname
  • Natural representation for records
  • Works well with object-oriented code

Working with Generated Code

After pasting into MATLAB:

% Run the generated code
% Access data (cell array example)
name = data{2, 1};      % Get first name
age = data{2, 2};       % Get first age

% Access data (table example)
names = data.Name;      % Get all names
avgAge = mean(data.Age); % Calculate average age

% Access data (struct example)
firstName = data(1).Name;
totalSalary = sum([data.Salary]);

Data Type Detection

The converter automatically detects data types:

  • Numeric: Values that can be parsed as numbers (integers or decimals)
  • String: Text values enclosed in single quotes
  • Mixed: Columns with both types use cell arrays

Variable Name Generation

For tables and structs, headers are converted to valid MATLAB identifiers:

  • Spaces and special characters replaced with underscores
  • Must start with a letter (adds 'Var_' prefix if needed)
  • Examples: "First Name" → "First_Name", "2nd Value" → "Var_2nd_Value"

Tips for Best Results

  • Use headers for table and struct formats
  • Ensure numeric data doesn't contain text for matrix format
  • Keep header names simple for easier variable access
  • Test the code in MATLAB after generation
  • Use appropriate format for your use case (table for analysis, matrix for computation)

MATLAB Version Compatibility

  • Cell Array: All MATLAB versions
  • Numeric Matrix: All MATLAB versions
  • Table: MATLAB R2013b and later
  • Struct Array: All MATLAB versions

MediaWiki Table Syntax

Supports standard MediaWiki table markup:

  • {|: Table opening with optional attributes
  • ! Header: Exclamation mark for header cells (separated by !!)
  • |-: Row separator
  • | Data: Pipe for data cells (separated by ||)
  • |}: Table closing

Privacy & Security

All conversions happen locally in your browser. Your MediaWiki data is never uploaded to any server, ensuring complete privacy and security.