How to assign one variable value to another variable and sort out the variable with a loop?
Mostrar comentarios más antiguos
Two variables: DataX and Sample Length of the vectors are same [n, 1]. The variable DataX has data values (double) and the variable Sample has 'n' values. The sample variable values are either 0 or 1. The question is, a function needs to be assigned which would hold the data values of DataX and assign to Sample. Furthermore, another array should be defined which would hold the values of DataX and assign the values to the position of Sample which has the value of 1. So, these '1' values with their respective original position containing the data from DataX should be stored in a different array.
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 14 de Jul. de 2016
out=DataX(logical(Sample))
Categorías
Más información sobre Numeric Types en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!