to make string file same size by adding missing string
hi, i have a file containing string information as following: GERMANY, 17, 19, 12, 16, 19, 13 FRANCE, 20, 23, 19, 12, 17, 18 INDIA, 7, 5, 11, 12, 13, 10 CROATIA, 8 , 9, 13, 11, 14, 11 USA, 30, 31, 25, 26, 23, 27
i transfer that to matlab now i have 70 files like this from which i have to read information but some file have information like this in which some countries are missing: GERMANY, 174, 219, 312, 216, 419, 713 INDIA, 77, 54, 110, 132, 133, 107 CROATIA, 88 , 95, 134, 117, 146, 119 USA, 230, 310, 325, 268, 237, 276 or like this GERMANY, 117, 139, 112, 136, 159, 113 FRANCE, 120,123, 139, 12, 17, 18 INDIA, 7, 5, 11, 12, 13, 10 USA, 30, 31, 25, 26, 23, 27
what i want is the countries which are missing in the string should be added at its appropriate place followed by zeros. so the final should look like this: GERMANY, 174, 219, 312, 216, 419, 713 FRANCE, 0, 0, 0, 0, 0, 0 INDIA, 77, 54, 110, 132, 133, 107 CROATIA, 88 , 95, 134, 117, 146, 119 USA, 230, 310, 325, 268, 237, 276 or like this for the second example above GERMANY, 117, 139, 112, 136, 159, 113 FRANCE, 120,123, 139, 12, 17, 18 INDIA, 7, 5, 11, 12, 13, 10 CROATIA, 0, 0, 0, 0, 0, 0 USA, 30, 31, 25, 26, 23, 27
the number of countries are 5 but some pages have 3 countries and most have 4 and even some have 2 countries. i want that the countries to be listed in the same order as the first list on the top and number of the missing countries to be zeroes. and to just inform all of it is string variable. please help on this matter cause i can't wrap my head around this problem. thanks, azim
0 Commenti
Risposte (0)
Vedere anche
Categorie
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!