Working on Binary Data using MATLAB
7 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (1 件)
Walter Roberson
2011 年 5 月 1 日
X(test(1,~isnan(test(1,:)))) = 1;
Y(test(2,~isnan(test(2,:)))) = 1;
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Standard File Formats についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!