datasets related 2 questions

1 回表示 (過去 30 日間)
Muazma Ali
Muazma Ali 2022 年 6 月 27 日
コメント済み: Walter Roberson 2022 年 6 月 27 日
Hi!
I have 2 questions:
  • Can I have a column in a dataset including two strings? how?
  • I know how I can download a dataset or import it in matlab but I dont know how I can make a dataset when I am computing values of different variables afterwards in my program. How can this be done?
thanks
  4 件のコメント
Muazma Ali
Muazma Ali 2022 年 6 月 27 日
Thanks, my problem is just that I want an array where each element consists of two words , as my grouping variable in gcatter: {"KCl", "NaCl"}
Walter Roberson
Walter Roberson 2022 年 6 月 27 日
You cannot do that with dataset(): the string() object will get converted to cell array of character vectors. Run the code I posted

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

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 6 月 27 日
No, dataset() does not support storing string() objects. dataset() automatically converts string() objects to a cell array of character vectors.
foo = ["a", "bc";"de", "f" ]
bar = dataset(foo)
This also shows one way to build a dataset() from computed variables.
I would not recommend any new development for dataset(). I recommend that you switch to table().

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by