From: Ramazan on
Hi, all,

I am using a Matlab2009b and I have a working code of...

[input_file,pathname] = uigetfile( ...
{'*.xls', 'Excel Files (*.xls)'; ... % Recomended file type is xls
'*.xlsx', 'Excel 2009 Files (*.xlsx)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select files', ...
'MultiSelect', 'off'); % User can only select single file at a time

% if file selection is cancelled, pathname should be zero
% and 'File not found' will be displayed
% otherwise 'File name will be displayed'
if isequal(input_file,0)||isequal(pathname,0)
disp('File not found')
else
disp(['File ', pathname, input_file, ' found'])
end

% input_file will be parsed into two matrix
% numData includes numerical data
% txtData includes Header and Row data names
[numData,txtData]= xlsread(input_file);

However, when my supervisor runs this code he gets an error of
"biffparse" error and says invalid record error.

my supervisor has Mac computer with matlab2010 version?

What is the problem and how can I fix this problem.

Thanks in advance,
From: Bruce on
"Ramazan " <perkyinatl(a)aol.com> wrote in message <i1psu2$2ce$1(a)fred.mathworks.com>...
> Hi, all,
>
> I am using a Matlab2009b and I have a working code of...
>
> [input_file,pathname] = uigetfile( ...
> {'*.xls', 'Excel Files (*.xls)'; ... % Recomended file type is xls
> '*.xlsx', 'Excel 2009 Files (*.xlsx)'; ...
> '*.*', 'All Files (*.*)'}, ...
> 'Select files', ...
> 'MultiSelect', 'off'); % User can only select single file at a time
>
> % if file selection is cancelled, pathname should be zero
> % and 'File not found' will be displayed
> % otherwise 'File name will be displayed'
> if isequal(input_file,0)||isequal(pathname,0)
> disp('File not found')
> else
> disp(['File ', pathname, input_file, ' found'])
> end
>
> % input_file will be parsed into two matrix
> % numData includes numerical data
> % txtData includes Header and Row data names
> [numData,txtData]= xlsread(input_file);
>
> However, when my supervisor runs this code he gets an error of
> "biffparse" error and says invalid record error.
>
> my supervisor has Mac computer with matlab2010 version?
>
> What is the problem and how can I fix this problem.
>
> Thanks in advance,

Hello Ramazan,

I found this solution on MW website which may account for your supervisor's
"biffparse" error. Please note the 'break' statement is missing in a vital part of your code too (as I describe below the MW solution).

"... Thus XLSWRITE as well as XLSREAD have limited functionality on the Mac platform.
....
Support for XLSREAD on Mac OS X may be considered for a future release of MATLAB. Unfortunately, there are no workarounds for the issue at this time."
(ref: http://www.mathworks.com/support/solutions/en/data/1-2SJUON/index.html?solution=1-2SJUON)
************************************************
BUT, also note you need to insert a 'break' statement in your code like so:
....
if isequal(input_file,0)||isequal(pathname,0)
disp('File not found');
break % INSERT HERE
else
....

If you don't do this then you get these error messages:
************************************************
??? Error using ==> xlsread at 122
Filename must be a string.

Error in ==> uiretrieve at 22
[numData,txtData]= xlsread(input_file);
************************************************

Cheers,

Bruce
From: Ramazan on
Hi Bruce

I did not know that, Great catch :) , thanks for your time,

Take care