After looking at multiple answer i have solved my question. I have removed the parfor loop that was there and used Vasishta Bhargava answer for the switch case. Thank you all for your help
close all
get = input('type(letters only, no puncuation): ' , 's');
split = char(lower(get));
input_prob = [];
for n = 1 : length(split)
switch split(n)
case ' '
input_prob = horzcat(input_prob,0.1859);
case 'a'
input_prob= horzcat(input_prob,0.0642);
case 'b'
input_prob = horzcat(input_prob,0.0127);
case 'c'
input_prob = horzcat(input_prob,0.0218);
case 'd'
2 Comments
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/655243-error-on-switch-case-with-cell-array-char-data#comment_1150418
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/655243-error-on-switch-case-with-cell-array-char-data#comment_1150418
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/655243-error-on-switch-case-with-cell-array-char-data#comment_1150423
Direct link to this comment
https://nl.mathworks.com/matlabcentral/answers/655243-error-on-switch-case-with-cell-array-char-data#comment_1150423
Sign in to comment.