including a data file

how would you include a data file in code
the matrix is large therefore i would prefer to quote it but i dont know how to do that
any help is much appreciated
matrices are the same size, dont know how to append it

4 件のコメント

dpb
dpb 2019 年 12 月 24 日
Providing far more specifics about your problem and objective might lead to some responses...this is too general to know where to begin.
Image Analyst
Image Analyst 2019 年 12 月 24 日
Did you try the usual input routines such as importdata(), dlmread(), xlsread(), readtable(), readmatrix(), etc.?
dpb
dpb 2019 年 12 月 24 日
"the matrix is large therefore i would prefer to quote it but i dont know how to do that"
If this is an invariant dataset to load at the beginning of a script or the like, it's always possible to just have an m-file that contains the assignment statement with the data values in it...then your script just calls that m-file and returns the result.
But, if it's relly large, reading it once and then saving as a .mat file that your script load 's will be faster by quite a bit.
Walter Roberson
Walter Roberson 2019 年 12 月 24 日
You can save() numeric files to text files and load() them as needed, or do a minor edit on the text file to make it an assignment statement that or function that returns the value.

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2019 年 12 月 24 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by