Thread Subject: min function

Subject: min function

From: ching l

Date: 24 Jul, 2008 14:39:03

Message: 1 of 3

[audio, fs] = wavread('F:\audio.wav');
samples{6} = {audio, fs};

[audio, fs] = wavread('F:\audio.wav');
samples{10} = {audio, fs};

playback= ceil(length(samples)*rand);

How do I put the minimum value for "playback". I've tried
the min function, but just can't get it right. Need a bit of
help here. Not sure how to put it in right order.

Thanks.

Subject: min function

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 24 Jul, 2008 17:29:25

Message: 2 of 3

In article <g6a467$dtq$1@fred.mathworks.com>,
ching l <chinglnc@hotmail.com> wrote:

>[audio, fs] = wavread('F:\audio.wav');
>samples{6} = {audio, fs};

>[audio, fs] = wavread('F:\audio.wav');
>samples{10} = {audio, fs};

>playback= ceil(length(samples)*rand);

>How do I put the minimum value for "playback". I've tried
>the min function, but just can't get it right. Need a bit of
>help here. Not sure how to put it in right order.

Please expand on what you mean by 'How do I put the minimum value
for "playback"' ? The variable playback will be a scalar value there,
and so is its own minimum.

If you want to know what the minimum value is that you have ever
had generated, then you will have to keep track of the 'playback'
values somehow. For example,

persistent minplaybackvalue
if isempty(minplaybackvalue)
  minplaybackvalue = playback;
else
  minplaybackvalue = min(minplaybackvalue, playback);
end

--
  "If there were no falsehood in the world, there would be no
  doubt; if there were no doubt, there would be no inquiry; if no
  inquiry, no wisdom, no knowledge, no genius."
                                              -- Walter Savage Landor

Subject: min function

From: Bruno Luong

Date: 24 Jul, 2008 17:56:03

Message: 3 of 3

"ching l" <chinglnc@hotmail.com> wrote in message
<g6a467$dtq$1@fred.mathworks.com>...
> [audio, fs] = wavread('F:\audio.wav');
> samples{6} = {audio, fs};
>
> [audio, fs] = wavread('F:\audio.wav');
> samples{10} = {audio, fs};
>
> playback= ceil(length(samples)*rand);
>
> How do I put the minimum value for "playback". I've tried
> the min function, but just can't get it right. Need a bit of
> help here. Not sure how to put it in right order.
>
> Thanks.
>

It's kind of count intuitive for normal people, I know, but
if you wants to force a minimum value under which the
playback values should not go below, then you should use 'max'.

% Bruno

Tags for this Thread

Everyone's Tags:

min

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
min ching l 24 Jul, 2008 10:40:22
rssFeed for this Thread

Contact us at files@mathworks.com