How to select one column value and the values associated in that row and plot
4 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have a table with 1416 rows and 5 coulmns. So, for every time instant 0.5 - 29.5 I have the Node C1, C2, C3 and so on.. I want to get the data specific to C1 and time instants,cachehits and cachemisses, cachehitratio associated with it and plot a graph between Time and CacheHitRatio.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1094900/image.png)
0 个评论
采纳的回答
Walter Roberson
2022-8-12
mask = ismember(YourTable.Node, 'C1');
subsetC1 = YourTable(mask, :);
2 个评论
Walter Roberson
2022-8-15
uniq_node = unique(YourTable.Node);
num_uniq = length(uniq_node);
subsets = cell(num_uniq, 1);
for K = 1 : num_uniq
this_node = uniq_node{K};
mask = ismember(YourTable.Node, this_node);
subsets{K} = YourTable(mask, :);
end
for K = 1 : num_uniq
this_subset = subsets{K};
plot(this_subset.Time, this_subset.CacheHitRatio, 'DisplayName', uniq_node{K});
hold on
end
hold off
xlim auto; ylim auto
legend show
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!