Data import from clipboard
Hi all, hope you are well.
Hopefully there is a simple answer to this question:
I'm importing data from an external software package - via a paste command. The data contains a header, followed by two columns, one for time and the second for magnitude.
Header header header
Time: x Magnitude:y
When this is pasted into Scilab, the entire data set is imported as a string (i.e. a one-cell variable).
What I want to do is import only the time and magnitude as an array variable, so that I can plot magnitude vs time.
Thanks in advance!
Yes there are multiple simple answers.
Solution1: Paste this data in to the scilab editor (not console). This data must be declared as a vector, something like time=[1 2 3 4] and magnitude=[100 200 250 400], for example. The reason you should keep them as separate vectors is to avoid the inclusion of a semicolon after the end of every row if you copy both time and magnitude at the same time.
Solution2: Paste the data in to a .txt file (without the headings, time and magnitude). Then use the scilab command data=fscanfMat("filename.txt") to import your data as a nX2 matrix. Now you can extract the required rows/columns to plot/process etc.
That worked perfectly!
I have one other basic question now - is there a simple command to take that data and remove values below a certain threshold?
Even better would be a command to split the data into sections based upon threshold limits (i.e. a square wave where we want to extract just the data from the top of the waves into separate data sets).
Thanks in advance for any help!