如何在VBA中每列2行生成对角线矩阵?

发布于 2025-02-07 15:50:08 字数 1547 浏览 3 评论 0原文

我试图将带有角和面部点的实验生成器的动态设计组合在一起。

例如(假设3个变量):

面部点具有格式中的矩阵(so#rows = 2*#vars,cols = #vars)

var1var2var3 var3
10.5 0.50.5 0.5
00.50.5 0.5
0.510.5 0.5
0.500.5
0.50.5 0.5 0.51
0.5 0.5 0.50.5 0.50

拐角点只有对角线矩阵(变量的行/cols =#变量)

var1var2var3
100 0
0 010 0
0 00 01

是的,我可以做到这一点在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)

Var1Var2Var3
10.50.5
00.50.5
0.510.5
0.500.5
0.50.51
0.50.50

Corner Points just have a diagonal matrix (rows/cols = # of variables)

Var1Var2Var3
100
010
001

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:
Blank Matrix

to:
Filled in Matrix

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文