Fraction calculation with Text
Mostra commenti meno recenti
Hey guys,
i have the following arrays which are saved separately in my Workspace(See below the screenshot). Array A is called "total" in my Workspace and Array B is named "relevant"

I need a code that gives me a table with the fractions:
Number the country is mentioned in Array B / Total number the Country is mentioned in Array A.
So for example: IT appears 2 times in Array B and 7 times in Array A. The fraction is 2/7 = 0.28...
It would be really nice if the fractions are then illustrated in a table in a descending order.
So the final table should look like:

I would really appreciate your help :)
Best Florian
Risposta accettata
Più risposte (1)
Image Analyst
il 14 Nov 2015
0 voti
I think you can do this with grpstats() in the Statistics and Machine Learning Toolbox, but I can't try it since you didn't provide any code to generate the arrays. If you don't have that toolbox, try the brute force way with ismember(). You might also need to use unique() and cellfun().
Categorie
Scopri di più su Get Started with MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!