使用matlab记录并保存在特定文件夹中

Using matlab record and save in a specific folder

我正在录制声音并使用wavwrite 来保存wav 文件,但我需要将它保存在C: 的特定文件夹中,例如c:\monitoringsystem。 这是我的代码的一部分:

format shortg
             c = clock;
             fix(c);
             a=num2str(c);
             year=strcat(a(1),a(2),a(3),a(4),a(5));
             month=strcat(a(19),a(20));
             day=strcat(a(34),a(35));
             hour=strcat(a(48),a(49));
             min=strcat(a(63),a(64));
             sec=strcat(a(74),a(75));
             name=strcat(year,'-',month,'-',day,'-',hour,'-',min,'-',sec);

             wavwrite(y,44100,name);
             y=[];

您可以在声音名称中包含文件路径。

         name=strcat(year,'-',month,'-',day,'-',hour,'-',min,'-',sec);

         fullpath = fullfile('C:\MYFOLDER',name);

         wavwrite(y,44100,fullpath);