I've been writing the code to plot the data for a Lab and I'm using a data structure method but I keep getting an error (in my four loop where I use xlsread to read all the files). The error says that I need Raw_Data(which contains an array of all the files I'm calling) as a character vector, in order for xlsread to work. I'm not sure how to do this and I have tried using Char and other methods but it still won't work. Attached is the code. 'CH0' and 'Ch1' are columns in my excel sheet that contain the data I need.
Raw_Data = {'Hot Water Trial 1.xlsx','Hot Water Trial 2.xlsx','Hot Water Trial 3.xlsx','Room Temp Trial 1.xlsx','Room Temp Trial 2.xlsx','Room Temp Trial 3.xlsx','Ice Water Trial 1.xlsx','Ice Water Trial 2.xlsx','Ice Water Trial 3.xlsx'};data = struct('CH0',[],'CH1',[]);for i = 1:length(Raw_Data) trial_data1= xlsread(Raw_Data(i),1); data(i).CH0=trial_data1(:,3); data(i).CH1=trial_data1(:,4); data(i).CH0_mean=mean(data(i).CH0); data(i).CH1_mean=mean(data(i).CH1);end
Best Answer