How do I use files from file exchange?

So I want to plot with 3 y axis and found some awesome work of people who shared them on file exchange.
How do I integrate them properly in my code ? Do I have to dl them and add them to same folder? If yes, how can I call them? Do I use their file name ?

 Respuesta aceptada

John D'Errico
John D'Errico el 25 de Jul. de 2020

2 votos

Download the .zip files.
Decompress same.
The result will be a directory. Add that directory to your search path. Pathtool is a good tool for this purpose.
Save the modified search path, so the next time you get into MATLAB, it will remember them.

Más respuestas (2)

Walter Roberson
Walter Roberson el 25 de Jul. de 2020

4 votos

John's answer on this is good, and can be used even with older MATLAB.
With new-enough MATLAB, you also have the option of using Add-On Explorer. Look in the ribbon of the command window for Add-Ons and click there and select Get Add-Ons . Use the window that comes up (the Add-On Explorer) to search for topics of itnerest. Click on one of them to verify it is what you want. In the upper right there will be a button for Install if you want to add that contribution to your MATLAB.
Burak Soydas
Burak Soydas el 26 de Jul. de 2020

0 votos

Thanks to both of you!
From that point on I just call the function? Or do I have to use a special line first in my code to load up the files?

3 comentarios

Rik
Rik el 26 de Jul. de 2020
Editada: Rik el 26 de Jul. de 2020
You should move this comment to the comment section of either answer (repost the text and then delete this 'answer').
But to answer your question: with Walter's solution Matlab will make sure the function is on the path. With John's solution you need to make sure the file is either on your path (as he describes), or in your current folder.
After that: yes, you can simply call the function as you would with any built-in function.
John D'Errico
John D'Errico el 26 de Jul. de 2020
Rik is correct, that please do not treat a question as a thread, where you just keep adding answers to make a comment. Use comments for that.
But once a file is on your search path, then MATLAB can always use it. It will now see this function always as long as you have saved the search path. There is no need to include it, for example as Python would require to load the function.
The one thing you never want to do is to put such a function in the matlabroot directory, or in any of the MathWorks provided toolbox directories.
Burak Soydas
Burak Soydas el 27 de Jul. de 2020
Allright, I got both now. Thanks to all of you for helping me out! :)

Iniciar sesión para comentar.

Categorías

Más información sobre File Operations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 25 de Jul. de 2020

Comentada:

el 27 de Jul. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by