在 mathematica 中使用 Input[] 输入数据 [英] Entering data with Input[] in mathematica

查看:81
本文介绍了在 mathematica 中使用 Input[] 输入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在此代码中使输入命令的对话框中的文本像这样输入 1 个元素"、输入 2 个元素"....

How can i make in this code the text in Dialog Box of the Input command to be like this "Enter the 1 element","Enter the 2 element"....

For[k = 1, k ≤ n, k++,
  br = Input["Enter the ",i,"element"];
  AppendTo[x, br];
]

推荐答案

确保您的变量匹配.:-)

Make sure your variables match. :-)

您可以使用 Row 来构建文本.

You can use Row to build up the text.

x = {};
n = 3;
For[k = 1, k <= n, k++,
 br = Input[Row[{"Enter the ", k, " element"}]];
 AppendTo[x, br];
 ]

(您也可以使用 StringJoin["Enter the ", ToString[k], " element"],但我更喜欢 Row.)

(You could also use StringJoin["Enter the ", ToString[k], " element"], but I like Row better.)

这篇关于在 mathematica 中使用 Input[] 输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆