How to display the indices data in command window automatically?

1 vue (au cours des 30 derniers jours)
Manoj
Manoj le 13 Juil 2018
Commenté : Manoj le 16 Juil 2018
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

Réponses (1)

Peter Meglis
Peter Meglis le 13 Juil 2018
Modifié(e) : Peter Meglis le 13 Juil 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:
  1 commentaire
Manoj
Manoj le 16 Juil 2018
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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by