Hello, The problem I am having is that when I run the final line of code I receive an error message "Function 'subsindex' is not defined for values of class 'cell'." Abb is a cell array with abbreviations. I am trying to assign the structure name as the abbreviation related the filename I am interested in. Any help would be greatly appreciated.
function [GSF,DateTime,WaterGallon,WUI]=struct_construction(filename)%%Import date and demand as a function of file name
%Using function to bring in date and demand for specific building
[DateTime,WaterGallon] = date_and_demand(filename);%%Import building specific attributes (gross square feet, filename,
%%abbreviation, etc.) for all buildings
%Importing attributes from master sheet
[BN,Abb,FN,BuildingType,Year,GSF,Water] = import_master_sheet('Master_sheet.xlsx','Sheet1',2,239);%%Constructing struct for each building as a function of filename
% Making Struct for Buliding and Computing Water Use Intensity
index = find(strcmp(FN, filename));B_GSF= GSF(index);WUI=WaterGallon./B_GSF;WUI_avg=mean(WaterGallon);char(Abb(index))=struct('GSF',B_GSF,'DateTime',DateTime,'WaterGallon',WaterGallon,'WUI',WUI,'WUI_avg',WUI_avg);end
Best Answer