Я прокомментирую ваш код, чтобы вы могли видеть, что и где происходит.
Кроме того, я предлагаю добавить (для целей отладки) еще два диска, как указано, чтобы вы могли видеть, что происходит.
%# uigetfile reads the name of a file and stores it in file_input, for example 'mydata.dat'
[file_input,pathname] = uigetfile( ...
{'*.txt', 'Text (*.txt)'; ...
'*.xls', 'Excel (*.xls)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select files');
disp(file_input)
%# fileparts splits file_input into name and extension. pathstr is empty, name is 'mydata',
%# ext is '.dat', and versn is empty
[pathstr, name, ext, versn] = fileparts(file_input)
disp(name)
%# name is a string containing, in our example, 'mydata'
%# r is the number of rows in the string 'mydata', which is 1
%# c is the number of columns in the string 'mydata', which is 6
r = size(name,1);
c = size(name,2);
disp(r)
disp(c)
Если вам нужен размер вашего набора данных, вам сначала нужно загрузить набор данных.
В качестве альтернативы, если ваш набор данных всегда имеет фиксированное количество столбцов, например, вы можете попытаться оценить количество строк по размеру файла
%# get the file size (and other information about the file) using dir
d = dir(fullfile(pathname,file_input));
%# if the header contains, say, 10 bytes, and each row is 8 bytes, you find the number of rows
%# as follows
headerBytes = 10;
rowBytes = 8;
nRows = (d.size-headerBytes)/rowBytes;