Effacer les filtres
Effacer les filtres

How to put the data into matrix / table?

1 vue (au cours des 30 derniers jours)
Muhammad Shaiful Bahri
Muhammad Shaiful Bahri le 22 Oct 2019
I have data that need to be insert in this matrix / table.
ship =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
The data is this.
code =
1×6 cell array
{'Alpha'} {'Bravo'} {'Charlie'} {'Delta'} {'Echo'} {'Foxtrot'}
I want it to be like this.
ship =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
{'Alpha'} {'Bravo'} {'Charlie'} {'Delta'} {'Echo'} {'Foxtrot'}
can anyone help me?

Réponse acceptée

Ankit Kumar
Ankit Kumar le 24 Oct 2019
Hi Muhammad,
A matrix must have all the elements of the same data type. Also a table can have different types of data but all the elements in a column must be of the same data type. So you cannot use both of them.
For your case you can create a cell array which can contain elements of various data types.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by