MATLAB: How to select colum values not by indexing but by their values

columnplotscattervalue

I have a very large data set, Ill give an example of how it looks like:
house id date power time
201103 '17/06/2010' 0 0
201103 '17/06/2010' 0 0,00138888888888889
200222 '17/06/2010' 0 0,00277777777777778
200222 '17/06/2010' 0 0,00416666666666667
and I want to plot PowerxTime but each plot for different values of houseid.

Best Answer

[unique_houseid, ~, houseid_group] = unique(houseid);
num_groups = length(unique_houseid);
for K = 1 : num_groups
this_houseid = unique_houseid(K);
mask = houseid_group == K;
this_power = power(mask);
this_time = time(mask);
fig = figure();
ax = axes('Parent', fig);
plot(ax, this_time, this_power);
xlabel(ax, 'time');
ylabel(ax, 'power');
title(ax, sprintf('power vs time for house id %g', this_houseid) );
end