Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!news.litech.org!News.Dal.Ca!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: matlab random object
Date: Fri, 11 Jul 2008 17:13:39 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 25
Message-ID: <g584c3$17v$1@canopus.cc.umanitoba.ca>
References: <g57qt2$s1s$1@fred.mathworks.com> <g57ut2$bp8$1@fred.mathworks.com> <g583sm$bsc$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1215796419 1279 192.70.172.160 (11 Jul 2008 17:13:39 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Fri, 11 Jul 2008 17:13:39 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:478883



In article <g583sm$bsc$1@fred.mathworks.com>,
ching l <chinglnc@hotmail.com> wrote:
>I'm so sorry, but that's not very clear...

>I'm quite new in matlab, basically, I need to make sure the
>file can be played randomly when i click the Play button in
>the gui........

>possible to do that?

[data, speed] = wavread(file1);
samples{1} = {data, speed};
[data, speed] = wavread(file2);
samples{2} = {data, speed};
[data, speed] = wavread(file3);
samples{3} = {data, speed};

uicontrol('Style','pushbutton','String','Play Randomly', ...
  'Units', 'normal', 'Position', [1/2 1/2 1/4 1/4], ...
  'Callback', @(src, evt) wavplay(samples{ceil(length(samples)*rand)}{:}) );

-- 
  "Beauty, like all other qualities presented to human experience,
  is relative; and the definition of it becomes unmeaning and
  useless in proportion to its abstractness." -- Walter Pater