Take user inputs via a for loop and then apply 'CrossTab'

4 次查看(过去 30 天)
Hello everyone,
I want a chi-square statistics value hence I want to user the function crosstab using n number of variables. Although this is permitted if I manually add the individual variables myself. (in the form of x = crosstab(a1, a2,...an)).
But in this scenario, I am asking the user to select 'n' number of data values (each is a column of categorical data) using a for loop. How do I input all the selected columns at once and apply the crosstab function ?
(
Maybe somthing like, a = [a1, ..., an]; x = crosstab(a); % This doesn't work though.
)

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by