From: bubai marik on
i am creating a function file in matlab,that takes an image file as input argument.now problem is to open a .dat file i have to use load() and to open a .tif file have to use imread() file.now I want to check the input file extension in my function so that depends on that i can use load() or imread().please reply as soon as possible.its very urgent.
From: Walter Roberson on
bubai marik wrote:
> i am creating a function file in matlab,that takes an image file as
> input argument.now problem is to open a .dat file i have to use load()
> and to open a .tif file have to use imread() file.now I want to check
> the input file extension in my function so that depends on that i can
> use load() or imread().please reply as soon as possible.its very urgent.

fileparts() and do string comparison on the extension you extract.


(I don't actually use this approach myself, but then my
suffix-extraction code for my current project is designed around the
fact that we can end up with multiple suffixes, such as .txt.mat .)