Having trouble using the struct function, to structure my data set.
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
% using the excel data 
[FileName, PathName] = uigetfile('*.xlsx','Select Excel files to analyze:','MultiSelect','off');
[status, sheets] = xlsfinfo([PathName, FileName]);
summary_data = xlsread([PathName, FileName],sheets{1});
Volume = summary_data(:,1); % in mL
Time = summary_data(:,2); % in Seconds 
Power = summary_data(:,3); % in watts;
numsheets = length(sheets);
data(numsheets-1) = struct('Volumes',[],'Times ',[],'Powers',[]); 
for j = 1:numsheets-1 ;
    rawdata = xlsread([PathName, FileName],sheets{j+1}); 
    data(j).Volumes = rawdata(:,1);
    data(j).Times = rawdata(:,2);
    data(j).Powers= rawdata(:,3);
end
%% error  I get After running 
Error using struct
Invalid field name "Times "
Error in Lab1 (line 11)
data(numsheets-1) = struct('Volumes',[],'Times ',[],'Powers',[]);
0 Commenti
Risposte (1)
  Walter Roberson
      
      
 il 4 Apr 2019
        You have 'Times ' in the struct() call. Change it to 'Times' with no space.
0 Commenti
Vedere anche
Categorie
				Scopri di più su Structures in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

