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
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');
Best Answer
Try this: