How can I "install" a function of file exchange in Matlab?
조회 수: 32 (최근 30일)
이전 댓글 표시
I'm a new Matlab user and I have a simple question. I found some good Matlab functions in the file exchange, like http://www.mathworks.com/matlabcentral/fileexchange/38848-historical-value-at-risk
But I don't know how to "install" that package to Matlab? So that I can use it with typing the function name and e.g. find the description in the Help of Matlab.
Thanks for your help.
댓글 수: 2
Edin Michael
2018년 6월 13일
편집: Stephen23
2018년 6월 13일
I have a similar question. In the link given above there is no mat file. So how do I add the function to the directory.
Stephen23
2018년 6월 13일
편집: Stephen23
2018년 6월 13일
" In the link given above there is no mat file"
Why does that submission require a .mat file? The submission you linked to contains two Mfiles, neither of which appears to load any .mat file, so it is not clear why you expect a .mat file to be included with the submission.
In any case, to use it click the Download button (top right-hand corner), and then unzip onto the MATLAB Search Path (e.g. the current directory), and it is ready to be used (following its instructions and help).
답변 (4개)
Sean de Wolski
2013년 1월 9일
You just have to make sure that the function is saved in a folder that is on the MATLAB path. You can add folders to the path using the pathtool. Simply type at the command line:
pathtool
댓글 수: 8
Walter Roberson
2018년 10월 3일
You have to pass in the image data. The documentation says:
% Examples
% -------
% % Threshold MATLAB's grayscale example image
% imshow(bernsen(imread('eight.tif')));
%
% % Threshold the attached jpg image
% imshow(bernsen(rgb2gray(imread('image.jpg')), [93,93]));
%
That is, you have to have image data, perhaps produced by imread, and you pass that image data to bernsen(), and it returns back an image, which you can store or display.
Wayne King
2013년 1월 9일
편집: Wayne King
2013년 1월 9일
Create a folder on your machine called histvar and then unzip the contents of that zip file into that folder, then at the MATLAB command prompt enter
>> addpath 'c:\histvar'
or whatever the appropriate command for your operating system is. You can also use pathtool to get a GUI for adding the folder.
The above will add that folder to the MATLAB path so that MATLAB can find the functions.
If you successfully add the folder to the MATLAB path, you can enter
>>which computeHistoricalVaR
and you see the path to that M-file. You should then be able to copy and paste the following code into the command window.
load data
confidence_level = 0.95;
plot_flag = true;
figure
VAR_hist = computeHistoricalVaR(returns,confidence_level,plot_flag)
Azzi Abdelmalek
2013년 1월 9일
click on download submission, you will download a zip file. After download, unzip your files then use them as matlab files
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!