1
votes

I want to plot a graph with 2 arrays, One is for time (X-Axis) and the other is for current (Y-Axis) but my scenario has some events like: interrupt received, timer expired or component up.

Events are strings which are present in between the elements (numbers) of array

Example:

time current
1     10
2     8
3     6
4     5
5     5

interrupt_received
6     60

component_up
7     65
8     70
...   ...
...   ...

I'm looking for a graph plotter to take the strings as inputs and show it on the graph with a X marker or color change is possible

Please let me know if there is any tool available to do so, or suggest ways to do it using Matlab or Octave Tool

Thanks a lot!

1

1 Answers

3
votes

Use the MATLAB PLOT itself and plot it point by point in a loop.

Use MATLAB Commands to detect if the incoming incoming one is string(not to be plotted) or a number(to be plotted).

Code -

str1 = newline_read_from_input_text_file;
if(isstrprop(str1(1), 'digit'))
    data1 = str2num(str1);
    plot(data1(1),data1(2))
    hold on
else
    do_something_with_the_events(str1);
end

If the events and the data are stored in a text file, you can read it within MATLAB itself - textread