Hello, I want to create a *.mat file, for example named bathymetry. This array called bathymetry I want to be formed by 3 other arrays, for example, x, y and z. In a way, that when I charged the mat file it transforms into three files called x, y and z.
I've tried my easy way: for example: bathymetry=[x,y,z], but when I charged it, it's only 1 file called bathymetry and I want to have them separetely.
Please help me.

2 件のコメント

the cyclist
the cyclist 2013 年 2 月 12 日
I don't know what you mean by "charge" the mat file.
Thorsten
Thorsten 2013 年 2 月 12 日
編集済み: Thorsten 2013 年 2 月 12 日
probably "load" (German "laden" can be translated as "charge" or "load", depending on context)

サインインしてコメントする。

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 12 日

10 投票

X=10
Y=20
Z=30
save bathymetry X Y Z
To load your data
load bathymetry

3 件のコメント

chaos4u2
chaos4u2 2013 年 2 月 13 日
Thank you!!
Annanya
Annanya 2022 年 11 月 26 日
which file extention to use to save mat file
Saytam Maddeshiya
Saytam Maddeshiya 2023 年 2 月 14 日
.mat

サインインしてコメントする。

その他の回答 (8 件)

the cyclist
the cyclist 2013 年 2 月 12 日

6 投票

Do you mean this?
% Create some variables
x = rand(3);
y = magic(3);
z = eye(3);
% Save the variable x,y,z into one *.mat file
save bathymetry.mat x y z
% Clear them out of the workspace
clear x y z
% Load them again
load bathymetry.mat

5 件のコメント

chaos4u2
chaos4u2 2013 年 2 月 13 日
Thank you!!
eevee
eevee 2014 年 11 月 26 日
Hi,
May I know how to do the other way round? I have got a .mat files with x,y,z. And I need to save the x,y,and z variables into a .xyz file in matlab?
Thanks!
the cyclist
the cyclist 2014 年 11 月 26 日
What is a .xyz file?
Also, I suggest you open a new question, with full details of your question, instead of burying your question as a comment in a year-old thread. It was pure luck that I happened to stumble on your comment.
Walter Roberson
Walter Roberson 2016 年 9 月 22 日
Machine Learning & Power Systems Ali comments
error when i save in .mat
Walter Roberson
Walter Roberson 2016 年 9 月 22 日
Machine Learning & Power Systems Ali: we are going to need more detail than that. What is your code, and what is your exact error message?

サインインしてコメントする。

matija corak
matija corak 2015 年 1 月 26 日

0 投票

Hello, I need help. I was record on my phone a sound. I want to hear that sound in matlab. How to do that? Thanks.

1 件のコメント

matija corak
matija corak 2015 年 1 月 26 日
I already tried with load and audioread and so on. Than I tried that sound convert in .wav and he still does not recognize that file. When I put for example load pcela.wav % pcela.wav is my name of that recorded sound Error using load Unknown text on line number 1 of ASCII file pcela.wav "RIFF’_".
Am I doing something wrong? Please help me I don't have no idea anymore and I cant find anything similar on web.

サインインしてコメントする。

Lobna Ragab
Lobna Ragab 2016 年 1 月 15 日

0 投票

How can I add many records to that file, I mean like
save filename X Y
X = 1,2,3,4
Y = 5,6,7,8
like table?

1 件のコメント

nitish kumar
nitish kumar 2023 年 2 月 28 日
just use the array like
X=[1,2,3,4]
Y=[5,6 7,8]
save filename.mat X Y

サインインしてコメントする。

geetu yadav
geetu yadav 2016 年 4 月 5 日

0 投票

svmStructDisease = svmtrain(diseasefeat,diseasetype); in this code how to create diseasefeat and diseasetype file?

1 件のコメント

Shivaprasad S
Shivaprasad S 2016 年 4 月 13 日
Same problem I am also facing please give some idea how to create I don't know anything please

サインインしてコメントする。

Machine Learning Enthusiast
Machine Learning Enthusiast 2016 年 9 月 22 日

0 投票

@ the cyclist

2 件のコメント

Bjorn Gustavsson
Bjorn Gustavsson 2016 年 9 月 22 日
That typically means that you don't have write permissions in the current directory. Move to somewhere else (cd...) and try again.
HTH
Walter Roberson
Walter Roberson 2016 年 9 月 22 日
You are probably cd'd to a directory that is underneath the MATLAB installation. The directory that MATLAB starts executing in is not necessarily your personal MATLAB directory.

サインインしてコメントする。

ramya anandan
ramya anandan 2017 年 6 月 7 日

0 投票

thank you so much Bjorn Gustavsson

1 件のコメント

Santhan S
Santhan S 2018 年 1 月 15 日
Thanks a lot.....

サインインしてコメントする。

Saravanan Nagesh
Saravanan Nagesh 2018 年 3 月 27 日

0 投票

@Machine Learning Enthusiast
Check the following code for the path of the current Matlab folder
path = pwd
use 'cd' to change it to another folder with write access.
usually, the default folder for Matlab code in most cases is" 'C:\Users\xxx'"
changing it to another drive solves this
tuncel3
tuncel3 2021 年 7 月 2 日

0 投票

First define a file name with its location
saveFileName='datafiles\filename2.mat';
next use below code to create an empty .mat file
save(saveFileName);

カテゴリ

ヘルプ センター および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by