how to get the usual form of a matrix from a txt file?
1 次查看(过去 30 天)
显示 更早的评论
hello, I have a matrix defined in a txt file as it follows:
row column value
1 1 -4.630
2 1 -4.307
3 1 -3.804
1 2 -4.630
2 2 -4.741
3 2 -4.630
1 3 -3.804
2 3 -4.307
3 3 -4.630
and I would like to put it back into the the matrix form provided by matlab (the square form), any suggestions ? Thank you in advance!
0 个评论
采纳的回答
KSSV
2016-11-23
data = importdata('data.txt');
num = data.data ;
matrix = reshape(num(:,3),3,[])
doc reshape
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!