How to display the indices data in command window automatically?
1 view (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Peter Meglis
on 13 Jul 2018
Edited: Peter Meglis
on 13 Jul 2018
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:
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!