以梦为马,不负韶华

搜索
查看: 4826|回复: 0
收起左侧

origin求助

[复制链接]
发表于 1970-1-1 08:00:00 显示全部楼层 |阅读模式
7.png
用的是8.5版本,看的是7.0版本教程。
数据提取时Analysis/Extract Data找不到了。
发表于 1970-1-1 08:00:00 显示全部楼层

回帖奖励 +2 个韶华币

8.0呵,你应该使用高级版本的教程,8.0是一个界限
回复 支持 反对

使用道具 举报

发表于 1970-1-1 08:00:00 显示全部楼层
我用的也是8.0,8.5不知道怎么样了...
回复 支持 反对

使用道具 举报

 成长值: 66850

发表于 1970-1-1 08:00:00 显示全部楼层
How do I extract data from one column based on text in another column?

Even within the restrictions of a rectangular grid there are numerous ways to arrange data that all make perfect sense. Unfortunately, many arrangements make it difficult to plot or analyze your data in Origin. Let's examine one fairly common arrangement and see how LabTalk can be used to rearrange the data into a form suitable for easy plotting and data analysis in Origin.

We often gather data in a random order and then need to look at characteristics of different parts of the data. Suppose we have data such as:

ProductShipped
Gadjet50
Widjet25
Thingamajig25
Gadjet50
Widjet25
Gadjet100
Widjet50
Thingamajig25
Gadjet100
Widjet50
Gadjet150
Thingamajig25
Gadjet200
Widjet25
Thingamajig50
and we wish to view and analyze the Shipped values by Product group. It's easy in Origin to sort a worksheet based on the values in one or more columns:

Highlight a column
Select Analysis : Sort Worksheet
Choose Ascending or Descending or refine the sort by choosing Custom
With the sorted worksheet, you could highlight a range of rows in the Shipped column and plot or analyze the sub-range as needed. But what happens when we have large numbers of groups (making selection tedious) or a plot type does not easily support sub-ranges? The answer is a script that extracts these groups to new columns. We can then plot and analyze the groups as needed.Note 1
Before we begin, let's assume that our Worksheet is the active window and that the first column contains our groups and the second column contains our measurements for these groups. Our first step is to sort the worksheet. We will use the SORT object and we will need to find the number of rows of data and the column names:


get wcol(1) -e last;        // Find the number of rows
%A=%(%H,@C,1);                // What's the name of the first column?
%B=%(%H,@C,2);                // What's the name of the second column?
With that information, we can sort the worksheet:

sort.C1=0;
sort.CNAME1$=%A: A;
sort.CNAME2$=%B: A;        // This is optional - delete if you want to keep Shipped values in natural order
sort.R1=1;
sort.R2=last;
sort.WKSNAME$=%H;
sort.wks();
Initialize two variables:

%B=wcol(1)[1]$;
count=0;
define a macro:

def NewGroup {
        wo -a 1;
        wks.col$(wks.ncols).name$=%B;
        for(jj=ii-count,row=1;jj<=ii-1;jj++,row++) wcol(wks.ncols)[row]=wcol(2)[jj];
}
and extract all the groups to new columns:

loop(ii,1,last) {
    %A=wcol(1)[ii]$;
    if("%A"!="%B") {
      NewGroup;
      %B=%A;
      count=1;
    } else {
      count+=1;
    }
}
NewGroup;
and clean up afterwards:

del -m NewGroup;
del -v count;
del -v last;
del -v ii;
del -v jj;
Now you can highlight any or all of the new group columns and plot or analyze as needed.

The algorithm works by looping through all the sorted group names. If the group name does not change, then just count it. When a name changes, a new column is created and the previous 'count' number of rows are copied to the new column

回复 支持 反对

使用道具 举报

不想打字就选择快捷回复吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|以梦为马,不负韶华

GMT+8, 2025-2-23 01:26

Powered by 以梦为马,不负韶华

© 2024-2099 Meng.Horse

快速回复 返回顶部 返回列表