Use the function command to open a vff. file

5 views (last 30 days)
parslee
parslee on 12 Feb 2024
Answered: Austin M. Weber on 12 Feb 2024
I'm trying to open a vff file on Matlab using a vff reader I found on File Exchange, but I'm not sure how to use the function command.
This is what I have:
function im = uigetfile('*.vff','Gel1.vff');
Thank you!
  1 Comment
Les Beckham
Les Beckham on 12 Feb 2024
Edited: Les Beckham on 12 Feb 2024
That line of code appears to redefine the built-in uigetfile function which you definitely don't want to do, especially if you plan to use that built-in function. You should probably read the documentation on how to create and use Functions in Matlab. Note that uigetfile only returns the name and, optionally, the path to a user selected file. It doesn't actually open that file.
Also, if you are just getting started with Matlab, I would highly recommend that you take a couple of hours to go through the free online tutorial: Matlab Onramp

Sign in to comment.

Answers (1)

Austin M. Weber
Austin M. Weber on 12 Feb 2024
The File Exchange function (vff3D.m) in the link that you provided does not have very good documentation. Ideally, you should be able to type
help vff3D
in the command window and it will output directions on how to use the function, but the way the function file is written prevents help from actually being helpful.
That said, I went through the code for the File Exchange function and, theoretically, it should be very straightforward to use. You do not need to write uigetfile to import your .vff file. The uigetfile command is already integrated into the function from the File Exchange.
As long as you downloaded vff3D.m and the function is stored on your current MATLAB search path, you should be able to simply type:
im = vff3D
into your code and click run. The vff3D function will automatically open up the file explorer on your computer. All you need to do then is navigate to your .vff file and select it. If the vff3D function works properly, it should automatically import your file into MATLAB as the variable im.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!