Finding values in an Array
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Aldo Amaya
el 30 de En. de 2014
Comentada: Aldo Amaya
el 30 de En. de 2014
If I have an array such as
Subject= [126;156;1992, 203, 186] % First two digits determine group, additional numbers are specific subject within that group.
Is there a method to only read the first two values of each row in order to determine what group the subject is?
Group= [12;15;19;20;18] %%%This is what I would like the result to be.
0 comentarios
Respuesta aceptada
Jos (10584)
el 30 de En. de 2014
Apply some arithmetic:
Subject = [126 156 1992 203 186 10 100 100000]
Group = fix(Subject ./ (10.^floor(log10(Subject)-1)))
Más respuestas (2)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!