如何在VBA中每列2行生成对角线矩阵?
我试图将带有角和面部点的实验生成器的动态设计组合在一起。
例如(假设3个变量):
面部点具有格式中的矩阵(so#rows = 2*#vars,cols = #vars)
var1 | var2 | var3 var3 |
---|---|---|
1 | 0.5 0.5 | 0.5 0.5 |
0 | 0.5 | 0.5 0.5 |
0.5 | 1 | 0.5 0.5 |
0.5 | 0 | 0.5 |
0.5 | 0.5 0.5 0.5 | 1 |
0.5 0.5 0.5 | 0.5 0.5 | 0 |
拐角点只有对角线矩阵(变量的行/cols =#变量)
var1 | var2 | var3 |
---|---|---|
1 | 0 | 0 0 |
0 0 | 1 | 0 0 |
0 0 | 0 0 | 1 |
是的,我可以做到这一点在MATLAB中简单,但是如果我可以严格将其保留在Excel中,那就更好了。试图使其动态化变得棘手,因此它不仅是3个变量,还基于用户输入(可能大于200个)。我还希望该矩阵从C11开始的新表输入到面部点,然后输入到角点的动态行号(该曲线在面部后立即开始)。
有人精通VBA愿意提供帮助吗?
更新(06/15):
我需要从:
to::
变量的列数=(示例)(示例为3个变量)
face point lows的数量= 2 *变量的(#)
变量行的数量=变量的(#)。
(#)变量基于用户输入是动态的。
I'm attempting to put together a dynamic design of experiments generator with corner and face points within an excel macro.
For Example (assuming 3 variables):
Face points have a matrix in the format (so # rows = 2*#vars, cols = #vars)
Var1 | Var2 | Var3 |
---|---|---|
1 | 0.5 | 0.5 |
0 | 0.5 | 0.5 |
0.5 | 1 | 0.5 |
0.5 | 0 | 0.5 |
0.5 | 0.5 | 1 |
0.5 | 0.5 | 0 |
Corner Points just have a diagonal matrix (rows/cols = # of variables)
Var1 | Var2 | Var3 |
---|---|---|
1 | 0 | 0 |
0 | 1 | 0 |
0 | 0 | 1 |
Yes, I can do this pretty simple in Matlab but if I could keep this strictly within excel it would be better. It gets tricky trying to make it dynamic, so instead of just 3 variables, it would be based on a user input (which could be as large as 200). I also want this matrix to be input onto a new sheet starting at C11 for the face points, and then the dynamic row number for the corner points (which start immediately after the face).
Anyone much more versed in vba willing to help?
UPDATE (06/15):
I need to go from:
to:
Number of Columns = (#) of variables (example is with 3 variables)
number of face point rows = 2*(#) of variables
number of corner point rows = (#) of variables.
(#) of variables is dynamic based on a user input.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论