Info
この質問は閉じられています。 編集または回答するには再度開いてください。
When I read a matrix stored in a text file, the values are shuffled about
1 回表示 (過去 30 日間)
古いコメントを表示
fid = fopen('mat.txt','r');
matrix = fscanf(fid,'%g',[6 4]);
Could someone explain why this happens? or suggest a better method?
The matrix consists of 1's and 0's
0 件のコメント
回答 (1 件)
Image Analyst
2015 年 3 月 17 日
Try fread() instead of fscanf(). Not sure that's the problem though. Are you sure you're not confusing (x,y) with (row, column)? That's the error most novices make. Remember (row, column) is (y,x) NOT (x,y).
2 件のコメント
Image Analyst
2015 年 3 月 17 日
編集済み: Image Analyst
2015 年 3 月 17 日
If you're still having a problem, attach the file with the paper clip icon. Or why not use dlmread() with a delimiter of space or tab, whichever it is?
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!