Open File From A Full File Path & Extension

26 ビュー (過去 30 日間)
Mohammad Maliq
Mohammad Maliq 2019 年 5 月 12 日
回答済み: Mohammad Maliq 2019 年 5 月 12 日
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 Center および File ExchangeStandard File Formats についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by