"computer" command not compatible with Matlab
Frederick_Umminger at playstation.sony.com
Frederick_Umminger at playstation.sony.com
Thu Feb 5 14:48:12 CST 2009
I'm just trying to run some scripts included with the CIPIC HRTF Database
(http://interface.cipic.ucdavis.edu/CIL_html/CIL_HRTF_database.htm). I
can't say whether they are following good coding practices or not, but the
result is that their scripts don't work with Octave. This particular
problem is easy enough to work around, but it is also easy enough to fix.
Here is the complete script that fails:
check_sound.m
% Script to check the OS to see if sound output is possible
% Copyright (C) 2001 The Regents of the University of California
play_sound_flag = 1;
switch computer,
case 'PCWIN' % MS Windows
if (exist('wavplay') ~= 2) & (exist('sound') ~= 2),
play_sound_flag = 0;
if show_warning,
fprintf('\n I''m sorry, but I could not find either
wavplay.m\n');
fprintf(' or sound.m on your MATLAB system.\n');
fprintf(' You can still use the graphics features,\n');
fprintf(' but the ''play'' actions will be unavailable.\n\n');
fprintf('Press any key to continue ... ');
pause;
fprintf('\n');
end;
end;
case 'LNX86' % Linux Intel for Matlab 5
if exist('sound') ~= 2,
play_sound_flag = 0;
if show_warning,
fprintf('\n I''m sorry, but I could not find sound.m\n');
fprintf(' on your MATLAB system.\n');
fprintf(' You can still use the graphics features,\n');
fprintf(' but the ''play'' actions will be unavailable.\n\n');
fprintf('Press any key to continue ... ');
pause;
fprintf('\n');
end;
end;
case 'GLNX86' % Linux Intel for Matlab 6 R12
if exist('sound') ~= 2,
play_sound_flag = 0;
if show_warning,
fprintf('\n I''m sorry, but I could not find sound.m\n');
fprintf(' on your MATLAB system.\n');
fprintf(' You can still use the graphics features,\n');
fprintf(' but the ''play'' actions will be unavailable.\n\n');
fprintf('Press any key to continue ... ');
pause;
fprintf('\n');
end;
end;
otherwise
play_sound_flag = 0;
if show_warning,
fprintf('\n I''m sorry, I do not know how to output sounds\n');
fprintf([' on your operating system -- ' computer '.\n']);
fprintf(' You can still use the graphics features,\n');
fprintf(' but the ''play'' actions will be unavailable.\n\n');
fprintf(' If you know what MATLAB function to call\n');
fprintf(' to output stereo sound, do the following:\n');
fprintf(' 1. Edit the case statement in ''check_sound.m''\n');
fprintf([' to add the additional case ''' computer '''.\n']);
fprintf(' 2. Edit the function ''play_sound_array'' to
include\n');
fprintf(' an appropriate call to your sound output
function.\n\n');
fprintf('Press any key to continue ... ');
pause
fprintf('\n');
end;
end;
Sincerely,
Frederick
"John W. Eaton" <jwe at octave.org>
02/05/2009 12:41 PM
To
Frederick Umminger/R&D/SCEA at Playstation
cc
Octave list <bug at octave.org>
Subject
"computer" command not compatible with Matlab
On 5-Feb-2009, Frederick_Umminger at playstation.sony.com wrote:
| Bug: The "computer" command behaves differently in Octave compared to
| Matlab. This breaks .m files that rely on it.
|
| Version: 3.0.3, Windows 32-bit
|
| Steps to reproduce:
| > computer()
| ans = i686-pc-msdosmsvc
|
| Should return:
| ans = PCWIN
I think that is taking compatibility a little too far.
Is it really necessary? If some code you have breaks because you
don't get precisely this result, then I think you should fix the
code. But, out of curiosity, how are you using the result in a way
that causes problems, and that couldn't be fixed by using ispc
instead?
jwe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20090205/6559cd35/attachment-0001.html
More information about the Bug-octave
mailing list