MATLAB: How to output specific rows from a .csv file based on data in the columns

csvdata analysisexcelreadtable

I need to display specific rows of data based on the patient number displayed in the first column. I attached a sample excel sheet of the data.
I have this code which is able to display the proper rows of data based on the input prompt from user, but it displays the cells with commas as NaN (not a number). I know I need to use the file as a .csv, but I cannot seem to find a way to display the data with the .csv file.
file = 'DL_info.xlsm';
data = xlsread(file);
columndata = data(:,1);
n = input('Patient number: ');
patientnumber = find(columndata>(n-1) & columndata<(n+1));
patientdata = data(patientnumber,:);
disp(patientdata)
In this case, the user would input a patient number, i.e. 4, and the code would output the rows that have 4 for the patient number. Is there any way to do this with a .csv file that also includes the cells with commas?
Thank you!

Best Answer

I was able to find the answer!
file = 'MatLabQuestionEx';
data = readtable(file);
n = input('Patient number: ');
PatientTable = data(data.Patient_index == n, :);
disp(PatientTable);
This code works perfectly for displaying the rows based on the patient number that is input by the user.