How to display the indices data in command window automatically?
1 回表示 (過去 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
0 件のコメント
回答 (1 件)
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:
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!