|
|
Re: split string and plot
Posted:
Nov 19, 2012 6:56 PM
|
|
dpb <none@non.net> wrote in message <k8e9e0$1du$1@speranza.aioe.org>... > On 11/19/2012 3:30 PM, Leyo Joseph wrote: > > Hello, > > > > I have matlab script to pull out data from a test instrument using TCP/IP. > > I got the data "stim_freq" as a string with 501 values separated by > > comma and "stim_gd" as a string with 501 values with comma separation. > > Using the following, I separated the string==> > > p=regexp(stim_freq,',','split'); > > pp=regexp(stim_gd,',','split'); > > Now p and pp are cell arrays. How to plot as x axis and pp as y axis? > > Since you want numeric values, rather than regexp(), use textscan instead... > > You'll get cell arrays still, but they'll be numeric and you can skip > the num2str() of the other way and just > > plot(p{:}, pp{:}) > > --
Thanks. Could you please give me a hint on how to proceed with textscan? The variable "stim_freq " is like (1685000000,1685630000,1686260000,1686890000,1687520000,1688150000,1688780000,.....) and the variable "stim_gd" is like (7.847651617E-009,7.840270671E-009,7.833383973E-009,7.826488771E-009,7.819906752E-009,7.813325228E-009,...). Basically, I want to plot the elements of stim_freq vs elements of stim_gd.
|
|