How to input data from one function to another one?
2 ビュー (過去 30 日間)
古いコメントを表示
Could anybody help me with this please? I have written a function in a m file. I'd like to write another function containing only data required for calculations. I am hoping the first function can take in the data written in the second function, and calculate automatically. Rather than I have to copy and paste the data to the command panel and run the function. If i want to make any change, I can simply change the data in the second function. and run it again. Thank you very much.
0 件のコメント
回答 (1 件)
Fangjun Jiang
2011 年 11 月 9 日
Write two functions:
function data=Fcn1
data=[1 3 2];
function result=ProcessData(MyData)
result=MyData+1;
In Command Window, you can do:
out=ProcessData(Fcn1)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!