循环中八度的矩阵生成
你好,我想在 GNU-Octave 中为不同的 N 生成一些大小为 Nx3 的随机矩阵。我想将每个矩阵保存到不同的文件中。
下面的脚本几乎完成了这项工作,但奇怪的是它只生成名为 int2str(N)
的文件;它不断覆盖上一次迭代生成的文件。
for i=1:10
N=(2**i)
A=rand(N,3);
save int2str(N) A
end
该脚本将 int2str(N) 本身解释为字符串。我该如何避免这种行为?
Hi I want to generate some random matrices of size Nx3 for varying N, in GNU-Octave. I want to save each of these matrices to a different file.
The script below almost does the job, but strangely it produces only file with the name int2str(N)
; it keeps overwriting the files produced at the previous iteration.
for i=1:10
N=(2**i)
A=rand(N,3);
save int2str(N) A
end
The script is interpreting int2str(N) itself as a string. How do I avoid this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用函数形式调用
save
:save(int2str(N), "A")
You can invoke
save
with the function form:save(int2str(N), "A")