How to display whos y in GUI edit text or static text ?

1 visualización (últimos 30 días)
Mohamad
Mohamad el 2 de Mayo de 2018
Editada: Jan el 2 de Mayo de 2018
file1='speech_demo.wav'
[y,Fs]=audioread(file1);
whos y
How to display whos y in GUI edit text or static text ?
  2 comentarios
Mohamad
Mohamad el 2 de Mayo de 2018
Editada: Jan el 2 de Mayo de 2018
file2='1.wav'
[y2,Fs2]=audioread(file2);
S = whos('file2','1.wav')
Field = fieldnames(S);
Data = struct2cell(S);
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.edit7, 'String', CStr);
but i get the following warning : Warning: Single line Edit Controls can not have multi-line text

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 2 de Mayo de 2018
Editada: Jan el 2 de Mayo de 2018
The actual problem is:
set(handles.edit7, 'String', CStr);
but i get the following warning :
Warning: Single line Edit Controls can not have multi-line text
All you have to do is to convert the GUI element from an "single line edit control" to a "multi-line edit control". According to dox uicontrol (link):
To enable multiple lines of text, set Max-Min>1
And as code:
set(handles.edit7, 'Min', 0, 'Max', 2);
Or apply the corresponding changes in GUIDE.
You see how useful it is to post the error or warning message in a question on the forum.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by