Borrar filtros
Borrar filtros

Logical array inside an expression

1 visualización (últimos 30 días)
Mohammed Qahosh
Mohammed Qahosh el 14 de Nov. de 2020
Respondida: KSSV el 14 de Nov. de 2020
I have the following expression:
A = { 'aim' , '4' ; 'result' , 'peak' }; C = strcmp (A, 'result' ); A (C, 2)
When I run the command it gives:
1 × 1 cell array
{ 'peak' }
what is the meaning of the last expression:
A (C, 2)
Thanks in advance for your help

Respuesta aceptada

KSSV
KSSV el 14 de Nov. de 2020
A = { 'aim' , '4' ; 'result' , 'peak' }; % this is cell array of strings
C = strcmp (A, 'result' ); % comapre the string 'result' from given string array A. This gives the logical index
A (C, 2) % show the string which at required index
Read about Strcmp. this stand for string compare.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings 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