[Scilab-users] ?==?utf-8?q? ?==?utf-8?q? stripchart?

shorne at energetiq.com shorne at energetiq.com
Wed Apr 26 16:13:19 CEST 2017


Antoin,e, thanks.
This is essentially what I was looking for.

I haven't used Xcos much - but I presume this could be wrapped up to use
there?

Thanks again -
Steve




From:	"Antoine Monmayrant" <antoine.monmayrant at laas.fr>
To:	"Users mailing list for Scilab" <users at lists.scilab.org>
Date:	04/26/2017 09:54 AM
Subject:	Re: [Scilab-users]	?==?utf-8?q? ?==?utf-8?q? stripchart?
Sent by:	"users" <users-bounces at lists.scilab.org>



Hi Steve,

I don't think stripcharts exist in Scilab.
That being said, you can emulate them pretty easily.
See below the most simple example of such an emulation.
In a more realistic scenario, you could replace my loop by a callback
function that updates the plot everytime a new datapoint is measured.

Hope it helps,

Antoine

//////////////////////////////////////////////////////////
npts=100;

y=rand(1,100);
x=1:npts;

h=scf();
h.children.tight_limits="on";
plot(x,y,'k.-');
xlabel('Time')
ylabel('Data')
e=gce();//handle to the plot

//dummy loop to simulate data generation and plotting
for i=1:1000
    oldxy=e.children.data;//old data

    newy=rand();//this would be your recently measured Y
    newx=oldxy($,1)+1;//this would be your recently measured X
    newxy=[oldxy(2:$,:);[newx,newy]];
    e.children.data=newxy;//update data
    xmin=min(newxy(:,1));
    xmax=max(newxy(:,1));
    ymin=min(newxy(:,2));
    ymax=max(newxy(:,2));
    e.parent.data_bounds= [xmin,ymin; xmax,ymax];//rescale plot
    sleep(50)//wait a bit for a slow scroll
end
//////////////////////////////////////////////////////////


Le Mercredi, Avril 26, 2017 15:30 CEST, shorne at energetiq.com a écrit:

>
> In doing some real-time work I would find a stripchart very useful.
> I have a process generating (say) 10 values/second,
> that emits two values  (Time,Temperature).  This might be an xcos
> calculation, or a realtime data stream.
>
> I would like to plot this data on a "stripchart" - to show only the (say)
> latest 10 seconds of data,
> with the plot scrolling to the left - new points  added to the right,
data
> falls off the end on the left.
>
> Digging through the docs I find no trace of such a creature.
>
> Am I missing something obvious, or do we not have this capability in
> scilab?
>
> Thanks,
> Steve

_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170426/1a63c87b/attachment.htm>


More information about the users mailing list