How do I use a function from File Exchange?
3 次查看(过去 30 天)
显示 更早的评论
Hi all,
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?
2 个评论
回答(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.
2 个评论
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:
run Test_Subplots
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!