Home Error: Function 'subsindex' is not defined for values of class 'datetime'
Reply: 0

Error: Function 'subsindex' is not defined for values of class 'datetime'

user1265
1#
user1265 Published in April 21, 2018, 4:00 am

I am working in MatLab and have this script that calls an excel file and then converts them into MatLab form.

Data=csvread('Group1LoadData.csv',1,0,[1,0,161675,21]);  %Loads the data from a csv file
date=Data(:,1)';
salePrice=Data(:,2)';
fuelCost=Data(:,3)';
Demand=Data(:,4)';
totalProd=Data(:,5)';
SteamSold=Data(:,6)';
turbine1Prod=Data(:,7)';
turbine1Fuel=Data(:,8)';
turbine1CO=Data(:,9)';
turbine1Nox=Data(:,10)';
turbine2Prod=Data(:,11)';
turbine2Fuel=Data(:,12)';
turbine2CO=Data(:,13)';
turbine2Nox=Data(:,14)';
db1Fuel=Data(:,15)';
db1Steam=Data(:,16)';
db2Fuel=Data(:,17)';
db2Steam=Data(:,18)';
steamProd=Data(:,19)';
steamFuel=Data(:,20)';
natGasDensity=Data(:,21)';
temp=Data(:,22)';
date=datetime(date,'ConvertFrom','excel');

What I am trying to do is create a new variable called "FuelCost" by calling the data from "fuelCost" in the previous code but only using specific dates, as shown.

% Group1BEclcs
tStart=date(:,40746);
tEnd=date(:,43635);
date_use=(tStart:tEnd);
FuelCost=fuelCost(:,(date_use));

However, I keep getting an error displaying

"Function 'subsindex' is not defined for values of class 'datetime'."

What exactly does this mean?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306535 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO