如何得到这个矩阵
我有这个矩阵:
S.No. A B
1 5268020 1756
2 15106230 5241
3 24298744 9591
4 23197375 9129
我想得到一个有两列 [X,Y] 的矩阵。 X 将从 S.No 中获取值。 Y 可以是 1 或 0。例如,对于 1 5268020 1756
,总共应该有 5268020 (1,0)
,即 (X,Y) 对和1756 (1,1) 对。
我怎样才能在Octave中得到这个矩阵?
I have this matrix:
S.No. A B
1 5268020 1756
2 15106230 5241
3 24298744 9591
4 23197375 9129
I want to get a matrix which will have two columns [X,Y]. X will take values from S.No. and Y will can be either 1 or 0. For example, for 1 5268020 1756
there should be total 5268020 (1,0)
i.e, (X,Y) pairs and 1756 (1,1) pairs.
How can I get this matrix in Octave ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确理解你的问题,你想用重复的条目 (x,0) 和 (x,1) 填充矩阵,其中 x=1...4,其中重复由 A 列和 B 列中的值确定。给定您提供的值,这将是一个巨大的矩阵(67,896,086 行)。因此,您可以尝试这样的操作(替换下面的 m,出于说明目的,它的元素较少):
出于
好奇,是否有任何理由不考虑像
where
n
,m
、p
、q
是在 A 列和 B 列中找到的值。这可能更容易处理,不是吗?If I understand your question correctly, you want to fill a matrix with repeated entries (x,0) and (x,1), where x=1...4, where repetition is determined by values found in column A and B. Given the values you supplied that's going to be a huge matrix (67,896,086 rows). So, you could try something like this (replace m below, which has less elements for illustrative purpose):
which yields
Out of curiosity, is there any reason not to consider a matrix like
where
n
,m
,p
,q
, are values found in columns A and B. This would probably be easier to handle , no?