Tim
Tim

Reputation: 61

??? Error using ==> dlmread at 55 Filename must be a string

[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"

Upvotes: 0

Views: 1549

Answers (1)

Jonas
Jonas

Reputation: 74940

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);

Upvotes: 2

Related Questions