Fraction calculation with Text
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 14 Nov. 2015
0 Stimmen
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().
3 Kommentare
Florian Fbr
am 14 Nov. 2015
Walter Roberson
am 14 Nov. 2015
Florian Fbr
am 14 Nov. 2015
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!