views:

99

answers:

1
[file_input, pathname] = uigetfile( ...
{'*.txt', 'Text (*.txt)'; ...
'*.xls', 'Excel (*.xls)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select files');

D = uiimport(file_input);
M = dlmread(D);
X = freed(M);

Getting errors with dlmread......"??? Error using ==> dlmread at 55 Filename must be a string."..need to get the data from dlmread to "freed"

+2  A: 

Why do you call uiimport? Just remove the line and pass file_input to dlmread.

[file_input, pathname] = uigetfile( ...
{'*.txt', 'Text (*.txt)'; ...
'*.xls', 'Excel (*.xls)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select files');

M = dlmread(file_input);
X = freed(M);

Alternatively, store the output of uiinput in a different variable. Thus, you have the data from uiinput and the data from dlmread/freed for subsequent computations.

[file_input, pathname] = uigetfile( ...
    {'*.txt', 'Text (*.txt)'; ...
    '*.xls', 'Excel (*.xls)'; ...
    '*.*', 'All Files (*.*)'}, ...
    'Select files');

some_data = uiimport(file_input);
M = dlmread(file_input);
X = freed(M);
Jonas