Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How can I add this text with values into my legend?

1 visualización (últimos 30 días)
Mary Hemler
Mary Hemler el 5 de Jun. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have the following code for my plot legend currently:
baseNames = {'T9C11','T8C7','T8C5','T9C6'};
baseValues = mutualInfoTotal([67 52 50 62]); % or whatever the indices are
NewNames = cellspikes(numel(baseNames,1));
for idx = 1:length(baseNames)
NewNames{idx} = sprintf('%s, MI = %2.2f',baseNames{idx},baseValues(idx));
end
legend(NewNames)
which ends up saying something like "T9C11, MI = 43.95" for each entry on the legend. But I would like to change this to "T9C11, MI = 43.95 bits/sec; 3.45 bits/spk" So I would like to draw from the corresponding index values of a different variable, MISpikeTotal, for the bits/spk values. How can I do this?

Respuestas (1)

Matt J
Matt J el 5 de Jun. de 2020
Editada: Matt J el 5 de Jun. de 2020
Couldn't you just modify your call to sprintf appropriately?
NewNames{idx} = sprintf('%s, MI = %2.2f; %2.2f bits/spk',...
baseNames{idx}, baseValues(idx), MISpikeTotal(idx));
  1 comentario
madhan ravi
madhan ravi el 5 de Jun. de 2020
Maybe it was too much to type xD for the OP.

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by