how to get multiple values of multiple columns from a single column?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a 100x100 matrix where the first column is time and the remaining 99 are % (from 0 to 100%). I would like to know the time value (column 1) where each column reaches the value 40 (40%).
Thank you very much.
0 comentarios
Respuestas (1)
Dyuman Joshi
el 5 de Mzo. de 2024
Editada: Dyuman Joshi
el 5 de Mzo. de 2024
(Assuming the value 40 occurs same number of times in each column)
%sample data
y = magic(5)
%closest value to 16
[v, k] = min(abs(y-16))
For columns 1:size(y,2) and the corresponding values in k, i.e. row values, are the closest to 16
s = size(y);
y(sub2ind(s, k, 1:s(2)))
1 comentario
Ver también
Categorías
Más información sobre Data Types 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!