Working on Binary Data using MATLAB
Afficher commentaires plus anciens
have loaded a text file test file in matlab. The load function has now created a variable test with values
1 2 3 4 5
2 3 NaN NaN NaN
Now I have a initialized variable X = [0 0 0 0 0 0 0 0 0 0 0] and Y = [0 0 0 0 0 0 0 0 0 0 0]. I want X to read the first row of test variable and corresponding to the number it reads change its value of the element from 0 to 1. Suppose it reads 1, it should change its element X(1) from 0 to 1. Similarly Y should do the same wrt second row of test.
Any idea how should I proceed?
Réponses (1)
Walter Roberson
le 1 Mai 2011
X(test(1,~isnan(test(1,:)))) = 1;
Y(test(2,~isnan(test(2,:)))) = 1;
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!