is there a way to automatically label columns with stackedplot with a common name?

조회 수: 5 (최근 30일)
hi, i have found how to use stackedplot, but so far i haven't found a way to make the stackedplot() to automatically make labels using the same name without having to input the name manually for each plot
i basically want to know if there is a way to make stackedplot() to instead of say column #, to say channel # without having to write "channel 1", "channel 2", "channel 3", etc

채택된 답변

KSSV
KSSV 2024년 11월 3일
You rename the labels of the table to the desired and use stackedplot.
A = rand(10,4) ;
T = array2table(A) ;
stackedplot(T)
% Rename the labels
T.Properties.VariableNames = {'a', 'b', 'c', 'd'} ;
stackedplot(T)
  댓글 수: 2
Stephen23
Stephen23 2024년 11월 3일
N = 4;
T = array2table(rand(10,N), 'VariableNames',"channel#"+(1:N));
stackedplot(T)
Ri go
Ri go 2024년 11월 3일
this, this ended up working for me, thank you so much both of you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by