How to compare tables/cells/characters?

28 visualizaciones (últimos 30 días)
Lexington Stoyell
Lexington Stoyell el 1 de Mzo. de 2018
Comentada: Stephen23 el 2 de Mzo. de 2018
Is there any way to compare (greater than or less than) using tables? Or is there a way to compare using cells or as a character? The data being compared are numbers of various length.

Respuestas (1)

Seyedali Mirjalili
Seyedali Mirjalili el 2 de Mzo. de 2018
Does the following help?
tf = strcmp(s1,s2) compares s1 and s2 and returns 1 (true) if the two are identical and 0 (false) otherwise. Text is considered identical if the size and content of each are the same. The return result tf is of data type logical. The input arguments can be any combination of string arrays, character vectors, and cell arrays of character vectors.
  4 comentarios
Lexington Stoyell
Lexington Stoyell el 2 de Mzo. de 2018
As stated in my original question I am comparing cells/characters/strings that are numbers
Stephen23
Stephen23 el 2 de Mzo. de 2018
@Lexington Stoyell: only numeric values can be considered to have the property greater/less than. Convert the strings to numeric if you want to make this comparison.

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by