Difference between a table and a matrix

63 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2018 年 5 月 27 日
コメント済み: Image Analyst 2018 年 5 月 27 日
What is a difference between a "table" and a matrix?
One can use save command to write a matrix data to a file. Can one use the same save command to write a table to a file?

採用された回答

Image Analyst
Image Analyst 2018 年 5 月 27 日
They're similar but a table can contain different types of data, though all elements in a column must be the same. A matrix/array must have all elements the same, even in different columns, except for a cell array which can have different kinds of variables at an element no matter where it is (no requirement that all elements in a column of a cell array contain all the same type of variable like is the case with tables and matrices).
You can use writetable() to write a table to a file.
  3 件のコメント
alpedhuez
alpedhuez 2018 年 5 月 27 日
編集済み: alpedhuez 2018 年 5 月 27 日
How does the table differ from the cell array?
Image Analyst
Image Analyst 2018 年 5 月 27 日
Tables are more memory efficient. Tables have a lot of nice functions for dealing with them, such as outerjoin, etc. Tables must have all variables in a single column be a single type, like string or double. With cell arrays, you can mix data types within a column, for example cell (3,4) could have a string but the next cell down at (3, 5) could contain an array or a structure or even another cell. See the FAQ for a good intuitive explanation: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by