am trying to cluster my data but matlabs keeps on indicating that Unrecognized table variable name 'sub_metering_1'.

7 ビュー (過去 30 日間)
>> 'C:\Users\Vlad\Downloads\household_power_consumption_2007';
>> data = readtable(file_path, 'Delimiter', ';');
X = data{:, {'sub_metering_1', 'sub_metering_2', 'sub_metering_3'}};
Error using {}
Unrecognized table variable name 'sub_metering_1'.
  3 件のコメント
Peter
Peter 2023 年 10 月 7 日
Thanks but it is already included; these are the variables
DateTime Global_active_power Global_reactive_power Voltage Global_intensity Sub_metering_1 Sub_metering_2 Sub_metering_3
Voss
Voss 2023 年 10 月 7 日
Sub_metering_1 has a capital S; sub_metering_1 has a lower-case s.

サインインしてコメントする。

回答 (1 件)

Dyuman Joshi
Dyuman Joshi 2023 年 10 月 7 日
Variable names in MATLAB, independently or of a data type, are case sensitive. You need to use the variable name with the proper case as it is defined.
For your case, that would be -
X = data{:, {'Sub_metering_1', 'Sub_metering_2', 'Sub_metering_3'}};

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by