
In the matlab programming, the top script file always call different functions. Also the function calls lower functions. but how to transfer the coefficient package
in the different layers functions efficiently? which is very important to matlab programs’ readability.
1.1 Directly method
when a function is called, the input and output coefficients are set as the input and output coefficients of the function.
e.x.
[outdata1,outdata2,outdata3….,outcoefficient1,coefficient2,coefficient3….]= function(indata1,indata2,….,incofficient2…)
1.2 Package method
It is very interesting to find the data type name “cell” in the matlab programming. It can be used as a package to all the input or output coefficient as a package.
2. assignin & evalin function
2.1 The basic description
These two function is offered by the matlab officially. You can find some docs in the official website.
For example
There are 3 functions named respectively 1.m 1a.m 1b.m.
and in 1.m file, the 1a.m and 1b.m are called in turn.
There are some coefficients are computed in 1.m, it is showed following:
also evalin and assignin function are used for coefficients transferring.
Now the coefficients transferring is done. Please watch out the difference of caller and base.
2.2 Conclusion
When there are so many input and output coefficients in the functions, these coefficients affected the readability obviously.
So you can switched to the evalin and assignin function, but the too many coefficients also will bring many evalin and assignin sentence. The best way is package all the coefficients as a cell package.
3 Plan
I gonna discuss the how to transfer coefficient in a complex and multiple layer function in the next times.




近期评论