Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Matlab binary files I/O > savematfile

savematfile

write a Matlab MAT-file (binary or ASCII)

Syntax

savematfile('filename')
savematfile('filename', 'var1', 'var2', ...)
savematfile('filename', '-struct', 's')
savematfile('filename', '-struct', 's', 'f1', 'f2', ...)
savematfile(..., '-v4')
savematfile(..., '-v6')
savematfile(..., '-v7')
savematfile(..., '-v7.3')
savematfile filename var1 var2 ...

Arguments

filename

character string containing the path of the file (needed)

format

data format to use

"-mat"

binary MAT-file (default)

"-ascii"

8-bit ASCII format

"-ascii" "-double"

16-bit ASCII format

"-ascii" "-tabs"

delimits with tabs

"-ascii" "-double" "-tabs"

16-digit ASCII format, tab delimited

"-v4"

A format that MATLAB Version 4 can open

"-v6"

A format that MATLAB Version 6 and earlier can open

"-v7"

A format that MATLAB Version 7 and earlier can open (default)

"-v7.3"

A format that MATLAB Version 7.3 and earlier can open

var1, var2

character strings containing the name of the variables to load (only for binary files)

"-struct" "s"

saves all fields of the scalar structure s as individual variables within the file filename.

"-struct" "s" "f1" "f2"

saves as individual variables only those structure fields specified (s.f1, s.f2, ...).

Description

saves variables in a Matlab MAT-file from Scilab. The Scilab data types are converted into the Matlab equivalents.

Examples

A = rand(10, 10);
B = sprand(100, 100, 0.1);
savematfile("test_matfile.mat", "A", "B", "-v6");
clear;
loadmatfile("test_matfile.mat");
disp(A)
disp(B)

// As a Matlab 7.3 file
A = rand(10, 10);
B = sprand(100, 100, 0.1);
savematfile("test_matfile.mat", "A", "B", "-v7.3");
clear;
loadmatfile("test_matfile.mat");
disp(A)
disp(B)

See also

  • load — Load a saved variable or a serie of variables
  • save — Save a variable or a serie of variables in a binary file
  • loadmatfile — loads a Matlab V6 MAT-file (binary or ASCII) into Scilab
  • mfile2sci — Matlab M-file to Scilab conversion function

Bibliography

This function has been developed following the "MAT-File Format" description: Mat-File Format

Report an issue
<< matfile_varwrite Matlab binary files I/O Matlab to Scilab Conversion Tips >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 19:26:59 CET 2018