Author |
Topic |
|
sudd0030
11 Posts |
Posted - 01/26/2016 : 6:56:11 PM
|
Hi,
In the MATLAB example, the following lines were used to add data to the graph: % Add data to data range invoke(dr, 'Add', 'X', worksheet, 0 , 0 , -1, 0 ); invoke(dr, 'Add', 'Y', worksheet, 0 , 1 , -1, 1 );
What do these last four digits signify? My only guess right now is that the last digit is the column from which the data is taken, but when I add more lines for an extra data series like this:
invoke(dr, 'Add', 'X', worksheet, 0 , 0 , -1, 0 ); invoke(dr, 'Add', 'Y', worksheet, 0 , 1 , -1, 1 ); invoke(dr, 'Add', 'X', worksheet, 0 , 0 , -1, 2 ); invoke(dr, 'Add', 'Y', worksheet, 0 , 1 , -1, 3 );
The resulting graph looks very screwy (see image here: http://imgur.com/7IIV13Q) with straight lines across that shouldn't be there and the data looping back on itself oddly.
Thanks, John
Origin 2016 Operating System: Win10 |
|
sudd0030
11 Posts |
Posted - 01/27/2016 : 12:22:19 PM
|
So the screwy lines seem to be coming from Origin improperly interpreting NaN cells from MATLAB (instead of NaN, the cells contain: -1.#IND).
As a fix for this, I simply converted my data from a double array to a cell array using num2cell(data). Origin is able to successfully interpret NaN in a cell array for some reason.
I'm still confused about the four digits in this command: invoke(dr, 'Add', 'X', worksheet, 0 , 0 , -1, 0 );
and would greatly appreciate documentation on what each digit does. |
Edited by - sudd0030 on 01/27/2016 12:52:27 PM |
|
|
Castiel
343 Posts |
Posted - 01/29/2016 : 04:59:08 AM
|
quote: Originally posted by sudd0030
So the screwy lines seem to be coming from Origin improperly interpreting NaN cells from MATLAB (instead of NaN, the cells contain: -1.#IND).
As a fix for this, I simply converted my data from a double array to a cell array using num2cell(data). Origin is able to successfully interpret NaN in a cell array for some reason.
I'm still confused about the four digits in this command: invoke(dr, 'Add', 'X', worksheet, 0 , 0 , -1, 0 );
and would greatly appreciate documentation on what each digit does.
int Add(LPCSTR Type, Worksheet wks, int r1, int c1, int r2, int c2 )
1. r1 - index of first row of the range, starting from 0 2. c1 - index of first column of the range, starting from 0 3. r2 - index of the last row of the range, starting from 0 and -1 means the last available row 4. c2 - index of the last column of the range, starting from 0 and -1 means the last available column
It's not explained in AutomationServer.chm, but OriginC.chm. Or you may check this: http://www.originlab.com/doc/OriginC/ref/DataRange-Add
妾+ 午旦 妹罕妾 妾伊 用仇 妾/ 岫ㄞ
妾京用 仍巨 件 侈 件戶' 甘岫平 /欠 白岫妹
併 艮 岫 奈 白 岫
岫 |
|
|
sudd0030
11 Posts |
Posted - 01/29/2016 : 11:15:26 AM
|
Thank you! I'm starting to realize that the relevant documentation for the automation servers is spread across all of the other Origin documentation. |
|
|
zrehman809
USA
1 Posts |
Posted - 10/30/2018 : 04:35:42 AM
|
There is more than one way to read data into MATLAB from a file. The simplest, though least flexible, the procedure is to use the load command to read the entire contents of the file in a single step. The load command requires that the data in the file be organized into a rectangular array. No column titles are permitted. One useful form of the load command is load name.ext where ``name.ext'' is the name of the file containing the data. The result of this operation is that the data in ``name.ext'' is stored in the MATLAB matrix variable called name. The ``ext'' string is any three character extension, typically ``dat''.
|
|
|
|
Topic |
|
|
|