East_Seed_1="MIA";
East_Seed_8="ATL";
for i=1:7
s=rand;
if s<MIA_prob_vs_ATL
s=1;
I want to create an algorithm that, given probabilities of each team against another and the 8 seeds will determine a playoff winner. I have defined the variables containing the seeds with the conference and the probabilities with the tickers.Is there some way I can get the probability referring to the seeds?(As to write East_Seed_1_prob_vs_East_Seed_8 in this case) Thanks guys, you're awesome
CodePudding user response:
clc; clear all; close all;
letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M'];
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
string = 'ABCADEM';
answer = [];
for i = 1 : length(letters)
indeces = strfind(string,letters(i));
for j = 1 : length(indeces)
answer(indeces(j)) = numbers(i);
end
end
doubleAnswer = str2double(sprintf('',answer));
CodePudding user response:
If you want the output to give the alphabetical order of the letters, 1 to 26, you can do this:
str = "ABCXYZ";
mat = char(str);
ds = double(mat) - 64
which gives
ds = 1 2 3 24 25 26