Filter löschen
Filter löschen

Open File From A Full File Path & Extension

64 Ansichten (letzte 30 Tage)
Mohammad Maliq
Mohammad Maliq am 12 Mai 2019
Beantwortet: Mohammad Maliq am 12 Mai 2019
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.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Mai 2019
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)

Weitere Antworten (1)

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

Kategorien

Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by