大家好,我在 matlab 中有一个问题。
我有一个文本文件,其中数据由空格分隔。示例如下:
3 4
1 3 6
2 4 5 7
1 3 0
0 0 -1 -2
1 -1 0 -1
-1 0 -2 0
1 -1 2 3 1
我想要做的是读取文本文件并生成这样的矩阵:
size_mat=[3,4];
B=[1,3,6];
NB=[2,4,5,7];
b=[1,3,0];
A=[0, 0, -1, -2;
1, -1, 0, -1;
-1, 0, -2, 0];
z=[1,-1,2,3,1];
%//In details I can highlight these points :
%//1st line is the size_mat matrix. This has always dimension 1X2. m=size_mat(1) & n=size_mat(2)
%//2nd line is the B matrix. Dimension is 1Xm
%//3rd line is the NB matrix Dimension is 1Xn
%//4th line is the b matrix Dimension is 1Xm
%//Starting from 5th line to the (last-1) line is my A matrix
%//whose size is actually equal to mXn where m=size_mat(1) & n=size_mat(2)
%//Last line is the z matrix Dimension is 1X(n+1)
我该怎么做这个matlab?
提前致谢 !!
请检查编辑。更新了要提取的矩阵的大小!