Extract values from a double list

7 visualizaciones (últimos 30 días)
THEODOROS
THEODOROS el 30 de Oct. de 2022
Editada: Jan el 30 de Oct. de 2022
Hi,
I am trying to learn Matlab and I have two questions.
1)How can I extract from the below double the first element (8)?
myList=[8;6;9;0;6;5;4;5;6;7];
2)Also how can I replace this:
1×4 cell array
{'A'} {'B4'} {'G6'} {'D5'}
to this
A -> B4 -> G6 -> D5
Thank you in advance.
  1 comentario
KALYAN ACHARJYA
KALYAN ACHARJYA el 30 de Oct. de 2022
myList=[8;6;9;0;6;5;4;5;6;7];
myList(1) % Index posotion
ans = 8
The second question I don't understand, is it a single cell or cells within cell? If you are a beginner, go through MATLAB Onramp

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 30 de Oct. de 2022
Editada: Jan el 30 de Oct. de 2022
Maybe the 2nd question means:
C = {'A', 'B4', 'G6', 'D5'};
D = strjoin(C, ' -> ')
D = 'A -> B4 -> G6 -> D5'
Use the online tutorial Kalyan has suggested. This is more efficient than asking the basics in the forum.

Más respuestas (0)

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by