How do I use a function from File Exchange?
1 ビュー (過去 30 日間)
I am not very familiar with functions, but I need to use one from file exchange to create a diagram.
I want to create a wind rose plot using this function: https://www.mathworks.com/matlabcentral/fileexchange/47248-wind-rose
I have my two vectors for direction and speed, but I am unable to get the function to work. I've tried using WindRose(direction,speed) at the top of the script. However, I get an error saying 'All functions in a script must be closed with an 'end'.
Could I get some guidance on how to use the function?
回答 (1 件)
Walter Roberson 2022 年 3 月 29 日
Use the Add-on Explorer to install the File Exchange contribution.
I checked the contribution. Some of the files define scripts but no functions inside, and other files define functions with no scripts. None of them define functions inside scripts. You would have had to merge the files, or edit them, or else perhaps the error is in code you created.
Stephen23 2022 年 3 月 30 日
編集済み: Stephen23 2022 年 3 月 30 日
"So I can't use this function because it is not written to include other scripts?"
It is not clear what "not written to include other scripts" means. That FEX submission consists of perfectly ordinary scripts and functions which can be called from any other scripts and functions.
" I get an error saying 'All functions in a script must be closed with an 'end'."
As that FEX submission does not include any functions defined in scripts (as Walter Roberson explained) the cause of that error is due to some other code or due to someone making changes to the FEX code after downloading it.
Lets download it, run it, and see if we get any errors. The script TEST_SUBPLOTS calls both WINDRANDOMDISTRIB and WINDROSE functions, so calling that seems like a good test:
Find more on Files and Folders in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!