フィルターのクリア

copy data from work space In a compact way

11 ビュー (過去 30 日間)
mohammad
mohammad 2023 年 6 月 24 日
回答済み: Image Analyst 2023 年 6 月 25 日
Suppose we have the data of a matrix(for example 50*100) in the workspace. How can we copy these values of this matrix in the editor environment in such a way that it occupies only one line of editor code?

回答 (3 件)

dpb
dpb 2023 年 6 月 24 日
移動済み: dpb 2023 年 6 月 24 日
See save, load to get persistent data saved as file.
There is no way to put constant data into a variable in the editor as text other than by writing the assignment code/data out explicitly; I forget whether code-folding whizard will let collapse a large data array for visible appearance of being out of the way like loop constructs, etc., or not...

Walter Roberson
Walter Roberson 2023 年 6 月 24 日
mat2str() provided you are comfortable with the possibility of losing the last two bits
Otherwise you can build a string such as using compose() but o it is not a simple call.

Image Analyst
Image Analyst 2023 年 6 月 25 日
Let's say your m is your 50*100 matrix in the base workspace, and you want to make a copy of it in your editor (script). Simply do this
mCopy = m;

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by