Open File From A Full File Path & Extension

95 次查看(过去 30 天)
Hello all
I have to be honest, what seems to be a very simple task is proving to be a huge nightmare to preform in Matlab.
I want to open a file from its full file path - but really struggling.
I have a variable that contains the full file path of a file that i want to open:-
T = C:\Users\mal\Documents\Matlab\Profile.csv
I simply want to open it - how can i achieve this?
The file is not always a .csv it can be xls or txt etc i simply want to open it and let windows decide which program to open it in.
Cany ideas?
Thank you.

采纳的回答

Walter Roberson
Walter Roberson 2019-5-12
T = 'C:\Users\mal\Documents\Matlab\Profile.csv';
winopen(T)
Note that this is specifically "let windows decide which program to open it in", not "let MATLAB decide which program or function to open it in". So for example for the CSV file, Windows would typically start up Excel and open the file in that, in a program disconnected from MATLAB, whereas MATLAB would typically use importdata() in order to read the file.
If you want MATLAB to decide how to open the file, then use open(T) instead of winopen(T)

更多回答(1 个)

Mohammad Maliq
Mohammad Maliq 2019-5-12
Walter
Thank you for coming to the rescue again.
:)

类别

Help CenterFile Exchange 中查找有关 Low-Level File I/O 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by