saving a data as .m with double elements

Hİ everyone,
How to save a dataset (like .csv) as .m workspace with all elements as double into this folder ?
THANKS

回答 (1 件)

Jayant
Jayant 2023 年 6 月 25 日
編集済み: Jayant 2023 年 6 月 25 日

0 投票

You can use save() function to save the dataset into your workspace.
Here are the steps to do it:
1) Create a new structure to store your dataset.
data = struct('dataset', dataset)
2) Use save function :
save(['folder_path' 'workspace.mat'], 'data')
You may refer this documentation to try other methods of using save() function.

4 件のコメント

feras
feras 2023 年 6 月 25 日
@Jayant maybe my quastion is not clear,
i have data file which contains data like
Time V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
0 -1.35981 -0.07278 2.536347 1.378155 -0.33832 0.462388 0.239599 0.098698 0.363787 0.090794
0 1.191857 0.266151 0.16648 0.448154 0.060018 -0.08236 -0.0788 0.085102 -0.25543 -0.16697
the file is .csv file and i want to use it in Matlab by saving as .m workspace with all elements as double into this folder.
Thank you
Stephen23
Stephen23 2023 年 6 月 25 日
"the file is .csv file and i want to use it in Matlab by saving as .m workspace with all elements as double into this folder."
Why not just use READTABLE directly on the CSV file?
So far there does not seem to be any good reason for duplicating the data in an Mfile.
Jayant
Jayant 2023 年 6 月 27 日
Yes, we can also use READTABLE. @Stephen23 thank you for the suggestion.
feras
feras 2023 年 6 月 29 日
Thank you very much @Jayant and @Stephen23 .

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

カテゴリ

製品

質問済み:

2023 年 6 月 25 日

コメント済み:

2023 年 6 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by