- #1
ruijorgemoren
- 2
- 0
Hi there!
I'm having problems with creating/using char arrays.
My actual code is: (I reduced the options to make it smaller here..)
ok, so basicly the funtion sound will play the wav's I want.
For example, if I want to play antonio.wav and then jose.wav I would do:
And this is when the array appears..
My idea is to have an array and every option that is choosed will create a new position in that array with the value, for example jose or antonio.
I'm not getting this to work with this code.. Array problems?
Help please..
Thanks in advance.
Rui.
I'm having problems with creating/using char arrays.
My actual code is: (I reduced the options to make it smaller here..)
Code:
int option;
int i;
fs=11025; %frequency
%load wave files into MATLAB vectors
[jose]=wavread('jose.wav');
[antonio]=wavread('antonio.wav');
[B]nomes=char(); % ?[/B]
option=0;
i=0;
while option~=12
clc;
disp('1-Jose');
disp('2-Antonio');
option=input('Quais os nomes que pretende reproduzir?');
i=i+1; %I do this to guarantee that we are in the first array position on the first option choosed
switch option
case 1
nome=[jose];
[B]nomes(i)=nome; % ?[/B]
i=i+1;
case 2
nome=[antonio];
i=i+1;
case 3
%etc, etc...
end;
sound(nomes,fs);
end;
ok, so basicly the funtion sound will play the wav's I want.
For example, if I want to play antonio.wav and then jose.wav I would do:
Code:
sound(antonio, jose, fs)
My idea is to have an array and every option that is choosed will create a new position in that array with the value, for example jose or antonio.
I'm not getting this to work with this code.. Array problems?
Help please..
Thanks in advance.
Rui.