MATLAB: Fantasy Football draft teams

gamestring inputs

Okay so I'm try to make a fantasy football draft and I need users to enter there team names but I want to make it so each team gets saved to an array and im having troubling figuring it out?
this is what i have so far:
clear;
clc;
clear;
clc;
fprintf('==============================================================\n')
fprintf(' Welcome to The MatLab Fantasy Football Draft!!\n')
fprintf('==============================================================\n')
fprintf('In this section you will enter how many teams will be playing.\n\n')
fprintf('There will be two rules for the amount of teams:\n 1: It needs to ')
fprintf('have an even ammount of teams \n 2: It has to be between 4-8\n\n')
teams = 0;
while teams < 4 || teams > 8 || teams == 5 || teams == 7
teams = input('Please enter amount of teams here: ') ;
clc;
if teams < 4
fprintf('Please enter 4 or more teams.\n')
elseif teams == 5 || teams == 7
fprintf('Please enter an even number.\n')
elseif teams > 8
fprintf('Please enter 8 or less teams.\n')
end
end
fprintf('==============================================================\n')
fprintf(' Welcome to section 2: Team names!!\n')
fprintf('==============================================================\n')
fprintf('In this section you will enter your teams names.\n\n')
M1 = [] ;
for r = teams:teams
row = [];
for c = teams:teams
names = input('Enter team names in : ', 's') ;
row = [row,names];
end
M1 = [M1, row];
end
M1
fprintf('==============================================================\n')
fprintf(' Welcome to section 3: Teams and Positions Neded!!\n')
fprintf('==============================================================\n')

Best Answer

Instead of that double for loop with teams:teams:
for r = teams:teams
row = [];
for c = teams:teams
names = input('Enter team names in : ', 's') ;
row = [row,names];
end
M1 = [M1, row];
end
have only this
names = input('Enter team names (separated by spaces) : ', 's') ;
teamNames = strsplit(names, ' ')
If the team names are just one word with spaces between words, this will put every team name into a cell array variable called teamNames where eash cell in that array is a character array with the name of one team.