Audio file information to be shown as text on GUI text

1 回表示 (過去 30 日間)
Mohamad
Mohamad 2018 年 5 月 1 日
編集済み: Jan 2018 年 5 月 1 日
Hi How to get the audiofile info to be shown on GUI as text : I mean i will prss a button in GUI and i need to show these information . Also is it possible to show individual as NumChannels , SampleRate in separate Text in GUI
CompressionMethod: 'Uncompressed' NumChannels: 1 SampleRate: 44100 TotalSamples: 4646687 Duration: 105.3671 Title: [] Artist: [] BitsPerSample: 16
  1 件のコメント
Jan
Jan 2018 年 5 月 1 日
I've removed the duplicate question. Please care for posting a thread once only.

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

採用された回答

Jan
Jan 2018 年 5 月 1 日
編集済み: Jan 2018 年 5 月 1 日
info = audioinfo(FileName);
Field = fieldnames(info);
Data = struct2cell(info);
CStr = cell(1, numel(Field));
for k = 1:numel(Field)
if ischar(Data{k})
CStr{k} = sprintf('%s: %s', Field{k}, Data{k});
elseif isnumeric(Data{k})
if isempty(Data{k})
CStr{k} = sprintf('%s: []', Field{k});
else
CStr{k} = sprintf('%s: %s', Field{k}, num2str(Data{k}));
end
else % No idea how to display this - adjust this as you like it:
CStr{k} = sprintf('%s: [%s]', Field{k}, class(Data{k}));
end
end
set(handles.listbox1, 'String', CStr);
Use the wanted GUI element instead of handles.listbox1 and define filename accordingly.
Maybe this is enough already:
Str = evalc(disp(info));
CStr = strsplit(Str, '\n');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by