MATLAB: How to convert an array to corresponding weekdays datetime If I have an array z = [ 1 2 3 4 5 6 7], how can I convert it to corresponding weekdays like p = [ monday tuesday wednesday thursday friday saturday sunday]? Best Answer I am not certain what you want. Try this: z = [ 1 2 3 4 5 6 7];p = { 'monday' 'tuesday' 'wednesday' 'thursday' 'friday' 'saturday' 'sunday' };chooseDay = 4;Out = p(z == chooseDay)producing: Out = 1×1 cell array {'thursday'}. Related SolutionsMATLAB: Can i have the own holiday if yes can any one help me please The weekends you can determine using the weekday function. The other days you would have to enter yourself. MATLAB: Trouble formating strings with fprintf. Try putting \t before every %20s, or else add spaces to the end of every day to make it as long as Wednesday. Related QuestionHow to create a vector with the first day of each monthHow to get an index like with ismember, but with values representing the number of occurancesCombining matrices of different sizes
Best Answer