Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Questions on the attached example

1 回表示 (過去 30 日間)
Michael Adelman
Michael Adelman 2012 年 8 月 12 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello,
and have a question about it:
Before I put data to 'ao' they use:
data = zeros(4000,1);
why put zeroes to the entire vector? How is it possible that I able to hear any sound after zeroing 'data'?
Thanks,

回答 (2 件)

Walter Roberson
Walter Roberson 2012 年 8 月 12 日
The data being used there is example data. Initialize "data" to whatever contents you want (but make sure that it is within range for the device.)

Michael Adelman
Michael Adelman 2012 年 8 月 12 日
Hello Walter,
I don't understand, zeroing 'data' is used for initialize only?
Thanks,
  2 件のコメント
Walter Roberson
Walter Roberson 2012 年 8 月 12 日
The code example is
data = zeros(4000,1);
putdata(ao,data)
start([ai ao])
Here, "data" is being initialized to something, just for illustration purposes. You could have initialized to 1's or to pi or to 42 if you wanted:
data = 42 * ones(4000,1);
putdata(a0, data); %queue's the 42's
start(a0);
If you already have a vector, then use it:
putdata(a0, YourColumnVector);
start(a0);
Michael Adelman
Michael Adelman 2012 年 8 月 13 日
Thank you

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by