How can I "install" a function of file exchange in Matlab?

32 visualizaciones (últimos 30 días)
Tobi
Tobi el 9 de En. de 2013
Comentada: Shel el 3 de Oct. de 2018
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 comentarios
Edin Michael
Edin Michael el 13 de Jun. de 2018
Editada: Stephen23 el 13 de Jun. de 2018
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
Stephen23 el 13 de Jun. de 2018
Editada: Stephen23 el 13 de Jun. de 2018
" 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).

Iniciar sesión para comentar.

Respuestas (4)

Sean de Wolski
Sean de Wolski el 9 de En. de 2013
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 comentarios
Walter Roberson
Walter Roberson el 3 de Oct. de 2018
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.
Shel
Shel el 3 de Oct. de 2018
Thanks alot.

Iniciar sesión para comentar.


Wayne King
Wayne King el 9 de En. de 2013
Editada: Wayne King el 9 de En. de 2013
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
Azzi Abdelmalek el 9 de En. de 2013
click on download submission, you will download a zip file. After download, unzip your files then use them as matlab files

Steven Lord
Steven Lord el 13 de Jun. de 2018
If you're using release R2015b or later, use the Add-On Explorer.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by