MATLAB: How to change string to number in excel file string to number Hi, I have an excel file that contains string (y and n). I read the file using xlsread. Now I want to replace all the y's with 1 and all the n's with 0. How can I do that? Best Answer data = {'y', 'y', 'n', 'y'};value = nan(size(data));value(strcmp(data, 'y')) = 1;value(strcmp(data, 'n')) = 0; Related SolutionsMATLAB: Executable file doc compiler/mcc MATLAB: Reading of xls file without nan Use this to get a cell array of mixed data types (doubles and char):[~,~,raw] = xlsread('myFile.xlsx') Related QuestionHow to read string data from a csv fileARRANGING TEXT FILEHow to delete rows that have string in fileHow to cipher an input file
Best Answer