Skip to main content
added 4 characters in body
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

Assuming the file containing the data has the extension ".tsv" and that you want to choose the file from a system file-open dialog (rather than type in the file name), it can be done with

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.tsv", WindowTitle -> "Select a TSV file"];
     If[path === $Canceled, $Canceled, Import[path, "HeaderLines" -> 1]]];
data
{{"CF2", "triplet", "CC", "NONE", 2.00761, -237.329, "plotted", "./3B1/CF2-CC-t.out"}, 
 {"CF2", "triplet", "DFT", "NONE", 2.00541, -237.601, "plotted", "./3B1/CF2-t.out"}}

If you don't want to be restricted to the extension ".tsv", use

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.*", WindowTitle -> "Select a data file"];
     If[path === $Canceled, $Canceled, Import[path, "TSV", "HeaderLines" -> 1]]];

But the file itself will still have to be a tab delimited file.

Assuming the file containing the data has the extension ".tsv" and that you want to choose the file from a system file-open dialog (rather than type in the file name), it can be done with

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.tsv", WindowTitle -> "Select a TSV file"];
     If[path === $Canceled, $Canceled, Import[path, "HeaderLines" -> 1]]];
data
{{"CF2", "triplet", "CC", "NONE", 2.00761, -237.329, "plotted", "./3B1/CF2-CC-t.out"}, 
 {"CF2", "triplet", "DFT", "NONE", 2.00541, -237.601, "plotted", "./3B1/CF2-t.out"}}

If don't want to be restricted to the extension ".tsv", use

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.*", WindowTitle -> "Select a data file"];
     If[path === $Canceled, $Canceled, Import[path, "TSV", "HeaderLines" -> 1]]];

But the file itself will still have to be a tab delimited file.

Assuming the file containing the data has the extension ".tsv" and that you want to choose the file from a system file-open dialog (rather than type in the file name), it can be done with

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.tsv", WindowTitle -> "Select a TSV file"];
     If[path === $Canceled, $Canceled, Import[path, "HeaderLines" -> 1]]];
data
{{"CF2", "triplet", "CC", "NONE", 2.00761, -237.329, "plotted", "./3B1/CF2-CC-t.out"}, 
 {"CF2", "triplet", "DFT", "NONE", 2.00541, -237.601, "plotted", "./3B1/CF2-t.out"}}

If you don't want to be restricted to the extension ".tsv", use

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.*", WindowTitle -> "Select a data file"];
     If[path === $Canceled, $Canceled, Import[path, "TSV", "HeaderLines" -> 1]]];

But the file itself will still have to be a tab delimited file.

Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

Assuming the file containing the data has the extension ".tsv" and that you want to choose the file from a system file-open dialog (rather than type in the file name), it can be done with

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.tsv", WindowTitle -> "Select a TSV file"];
     If[path === $Canceled, $Canceled, Import[path, "HeaderLines" -> 1]]];
data
{{"CF2", "triplet", "CC", "NONE", 2.00761, -237.329, "plotted", "./3B1/CF2-CC-t.out"}, 
 {"CF2", "triplet", "DFT", "NONE", 2.00541, -237.601, "plotted", "./3B1/CF2-t.out"}}

If don't want to be restricted to the extension ".tsv", use

data = 
   Module[{path}, 
     path = 
       SystemDialogInput["FileOpen", "*.*", WindowTitle -> "Select a data file"];
     If[path === $Canceled, $Canceled, Import[path, "TSV", "HeaderLines" -> 1]]];

But the file itself will still have to be a tab delimited file.