Storing Wav files in an array

5 ビュー (過去 30 日間)
Enes Ozdogan
Enes Ozdogan 2021 年 12 月 18 日
編集済み: Stephen23 2021 年 12 月 18 日
Sry im new to matlab been using it only for homworks
So i was trying to divide a .wav file into 7 parts and store them in a array of size 7 got this error
CODE
[tel,fs]=audioread('tel.wav');
n=7;
d=floor(length(tel)/n);
for i=1:n
a[i]=tel(1+(i-1)*d:(i*d));
sound(a[i]);
end;
ERROR
Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check for mismatched delimiters.
  3 件のコメント
Enes Ozdogan
Enes Ozdogan 2021 年 12 月 18 日
Hi thank you
but now i get this error
Unable to perform assignment because the indices on the left side are not
compatible with the size of the right side.
Error in odev2 (line 9)
a(i)=tel(1+(i-1)*d:(i*d));
Stephen23
Stephen23 2021 年 12 月 18 日
編集済み: Stephen23 2021 年 12 月 18 日
You get that error because you are trying to assign multiple elements into one element of an array. That will not work.
Is it required to store all of the data in array a ? If you do not need the data to be available after the loop then just get rid of the indexing entirely. Otherwise you will need to use e.g. a cell array:

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by