updating data in a function from a script

4 次查看(过去 30 天)
Hey, I have 5 functions and one script. I want to update data in one of the functions, to be used in function two, when function two is called in the script. this is the first function: busdatas.m. The second function is loadflow.m. loadflow function, uses data from function busdatas.m and other functions to do loadflow. in my script, named: indexing, I want to update databus.m data before using it in load flow. The data is not changed when carrying out loadflow, it changes only in the script when displaying. Kindly help me update the data line 38 of the script named indexing. I have tried to use setappdata and getappdata functions, but I am getting it wrong, Kindly help me.

回答(1 个)

Walter Roberson
Walter Roberson 2018-5-5
Do not do it that way. Instead, load the data once inside indexing.m, and make any necessary modifications to it, and then pass it around to the other functions. See http://www.mathworks.com/help/matlab/math/parameterizing-functions.html
  1 个评论
erick oibi
erick oibi 2018-5-5
Thanks for the response, but for this particular case, I have not still understood how to pass the data line 37 of the indexing script, to modify the busdata function so that the modified data is used in loadflow.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by