Scan matrix from clipboard instead of file

Normally i would import/scan a matrix from an external measurement system using the below line. Which works perfectly fine.

x=fscanfMat(‘data.txt’);

Is there a way to do the same, but read the matrix from the clipboard instead of saving it to a file first, i.e. something like this:

x=fscanfMat(clipboard(“paste”));

This of course doesn’t work since fscanfMat expects a file and not a string.

Below is what’s on the clipboard. All I need is the Curve data.

SourceDesc=‘Clipboard_data’;
GraphTitle = 'xxxl;
GraphColor = 8355584;
GraphLineType = 10;
Data_Legend = ‘xxx’;
Data_Format = ‘LevelDB’;
Data_Domain = ‘Frequency’;
Data_LevelType = ‘Rms’;
Data_AbscUnit = ‘Hz’;
Data_BaseUnit = ‘V’;
Data_LevelRef = 2.5862695e-05;
Curve = [
20.507813 64.076492
21.240234 64.469048
21.972656 64.978493
22.705078 65.605576
23.4375 66.178368

19998.78 78.172462
19999.512 78.172];

Hello,

I am not sure that fscanfMat would help to parse this data. I would just detect the position of the string "Curve = " then evaluate the rest of the string:

str=clipboard("paste");
i=strindex(str,"Curve = ")+7;
curve=evstr(part(str,i:$))

S.

Thank you, that worked fine.

(fscanfMat works fine on the same data when read from a text file. It stores all the non-numeric lines in a string and the rest is returned as a matrix.)