MATLAB Answers

Cross tabulation row percentages

3 views (last 30 days)
Sarah Yun
Sarah Yun on 31 Dec 2019
Edited: TADA on 31 Dec 2019
Hello,
I have a table with 4 columns and 5 rows
I want to display the row values as percentages
example
date sale 1 sale 2 total sales
1989 4 (x%) 3 (x%) 7(x%)
7 would be 100%
now express 4 and 3 in terms of 100%?
How to do this for my table in matlab?
Thank you.

  0 Comments

Sign in to comment.

Accepted Answer

TADA
TADA on 31 Dec 2019
Edited: TADA on 31 Dec 2019
How about something like that?
t{:,{'sale1','sale2'}} = t{:,{'sale1','sale2'}}./t.totalsales * 100
Given that t is your table, or a copy of that so you don't override your original data

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags


Translated by