MATLAB: How to use cells as xlabel in stackedplot

MATLAB: How to use cells as xlabel in stackedplot

label;plotplottingstackedplotylabel

I have a matrix with 5 columns and the names of the variables as cells. I want to use the cells as the ylabels in the stackedplot. Can anyone help?

Best Answer

  • First convert your matrix to a table and use the variable names in your cell array.
    T = array2table(x, 'VariableNames', varNameArray);
    stackedplot(T)
  • Add a Comment

    Your email address will not be published. Required fields are marked *