How to use words in a matrix?

12 visualizaciones (últimos 30 días)
Taylor Gates
Taylor Gates el 18 de Jul. de 2018
Editada: Geoff Hayes el 18 de Jul. de 2018
I'm trying to create a matrix with products on column 1 and price on column 2. When I try to use words in column one it gives me errors. How can I use words in a matrix to accomplish this?

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 18 de Jul. de 2018
Editada: Geoff Hayes el 18 de Jul. de 2018
Taylor - if you are mixing numbers with strings, then create a cell array which will allow you to have elements of different types. For example,
myData = {'Product 1', 10; 'Product 2', 20};

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by