How to write a structure variable in m file through another script?
显示 更早的评论
How to write a structure variable in m file through another script? Eg. I want to write a structure like a.b.c in m file through script
7 个评论
madhan ravi
2018-10-28
Example?
Partha Mitra
2018-10-28
Stephen23
2018-10-28
"How to do this"
Learn to use functions (which are much better than scripts), and then simply pass those values are input/output arguments. Anything else is a waste of time (your time, and run-time).
Partha Mitra
2018-10-28
Partha Mitra
2018-10-29
madhan ravi
2018-10-29
Post your solution too because it’s interesting
Stephen23
2018-10-29
"If anyone has a better solution please let me know."
Convert to functions and pass the data as input/output arguments. This is "better" in the sense that it will be faster, will not impede the JIT engine, will be easier to debug, will allow memory management to handle the variables properly, and will be easier to understand. Printing strings in files is meta-programming, which is not recommended.
Functions are what experienced users use to write neat, efficient code. You should use them too.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Variables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!