How to avoid Warning when assigning values to a table
Mostrar comentarios más antiguos
Hello,
I have the attached table. I create an empty table and then add each variable separately from the name of files in a folder, and then assign them one by one for each row. This works, but I get a warning:
'Warning: The assignment added rows to the table, but did not assign values to all of the table's existing variables. Those variables are extended with rows containing default values. '
So even though there are no problems, I would like to do it in the most robust way. How can I avoid the warning? Is there a way to assign all variables at once for each row?
wavTimes.(rec_SN)=[]; %create empty output table
wavTimes.(rec_SN)=array2table(wavTimes.(rec_SN));
%get start and end time of each .wav file in folder
for ii=1:length(d)
disp(d(ii).name);
filename=fullfile(rec, d(ii).name);
split_fn=strsplit(filename,'.');
wav_date=datetime(split_fn{2},'InputFormat','yyMMddHHmmss');
wavTimes.(rec_SN).wavFileName(ii)={d(ii).name};
wavTimes.(rec_SN).wavDateTime(ii)=wav_date;
wavinfo=audioinfo(filename);
wav_length=wavinfo.Duration;
wavTimes.(rec_SN).wavEnd(ii)=wav_date+seconds(wav_length);
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!