How to display the indices data in command window automatically?

3 次查看(过去 30 天)
Find the attachment of the data contains 2 columns, 1st column is sequential increment values and 2nd one is before and after 0 data is there w.r.t the 1st column. I need to read only the indices data (say @11.2 and 13.5 )and display in command window . Along with that if I plot 1st column versus 2nd column, at that particular indices data i need to display the text with horizontal or vertical alignment and markers also. thanking you

回答(1 个)

Peter Meglis
Peter Meglis 2018-7-13
编辑:Peter Meglis 2018-7-13
Hi Manoj,
From my interpretation it sounds like you want to get values from the second column of a table based on a condition (like the data is 13.5) from the first column, as well as plot multiple values and add markers or labels. Here is some sample code that I wrote up doing that:
table = readtable('data.xls');
table.Properties.VariableNames = {'ColA', 'ColB'};
% Indexing based on condition
value = table.ColB(table.ColA == 12.6)
% Indexing based on multiple values
rowIdx = ismember(table.ColA, [11.1 12.6 13.5]);
multipleValues = table(rowIdx, :)
xs = multipleValues.ColA;
ys = multipleValues.ColB;
plot(xs, ys, 'o')
text(xs, ys, 'Text', 'HorizontalAlignment', 'left', 'VerticalAlignment','top');
xlabel('X Axis');
ylabel('Y Axis');
Hopefully this helps you get started, if you want more information, take a look at:
  1 个评论
Manoj
Manoj 2018-7-16
Thank you for your reply.Output plot is okay. But I need only the indices of 11.7 and 13.5, should be detectable automatically.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by