(求助)資料分析 有辦法半自動嗎



贊助商連結


purk
2003-04-17, 01:59 PM
一堆genome的資料 是microarray的東西 已經存成xls檔了
總共500多MB 有10000多個genome 每筆資料要分成單一genome在每次實驗中的比較跟多個實驗中多genome的比較
要做數值分析找出他們的相關性 所以要算每筆資料的log值跟資料間的距離
來做出相關性圖表

我會手動作 但是10000*80000多的資料量 根本弄到昏頭
又要考試 有誰知道有啥巨集或程式可以自動抓取表單內的資料 做出我預設的計算嗎

贊助商連結


ivantw
2003-04-17, 02:09 PM
建議將資料都匯到資料庫,以資料庫來作處理,可節省較多人工處理。

purk
2003-04-20, 11:54 PM
請TIM 幫我一起弄了個巨集
結果excel當給我看
怎麼如此不濟ㄚ
如何會到資料庫 然後擷取要的資料呢
thx

Raven
2003-04-21, 12:25 AM
那個情形應該不是當吧??
應該是資料太大讀取要一段時間!!~~

比較簡單的用Access匯入,檔案選XLS檔!!~~

purk
2003-04-21, 01:51 AM
附上我的巨集
請幫我想一下 該如何取消裡面的 消除剪貼簿的 對話框
要執行這個 巨集
請先在c下建立exptsetno_901資料夾 然後將以下這3個檔案下載後
ftp://genome-ftp.stanford.edu/pub/smd/experiments/7001-8000/7271.xls.gz

ftp://genome-ftp.stanford.edu/pub/smd/experiments/7001-8000/7272.xls.gz

ftp://genome-ftp.stanford.edu/pub/smd/experiments/7001-8000/7273.xls.gz

解壓存到exptsetno_901資料夾內

案後開啟這個檔 執行巨集 即可
thx

purk
2003-04-29, 01:01 AM
我繼續來問

我該如何 用巨集 讓他自己開一連串的 連續檔案

我要開1-114的檔 再我執行完一系列的事後 自己開檔

以下是我的 巨集 我要如何改

Sub Macro1()
'
' 巨集表
' 錄製的巨集
'

'
ChDir "C:\exptsetno_901"
Workbooks.OpenText Filename:="C:\exptsetno_901\7271.xls", StartRow:=27, _ >>>>>>>>>>這裡是說 開啟7271.xls檔,我共有114的xls 我將改成1編到114, 可以幫我血一個迴圈 讓他可以 做完我要求動作後自己開啟嚇一個檔嗎 郵1開始到114


, StartRow:=27, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
Columns("D:D").Select
Windows("BooK1").Activate >>>>>>>>我會將每個XLS檔的 要的內容存到BOOK1的工作表內 可以幫我血一個迴圈讓他可以 做好以下動作 換到下一個xls檔時就自己開一個book1的工作表嗎
Windows("7271.xls").Activate >>>>>轉換到第1個xls檔 確定該工作表存在 以繼續擷取動作
Columns("D:D").Select >>>>>>選擇該工作表範圍
Selection.Copy 複製該範圍
Windows("BooK1").Activate >>>>>>確定BOOK1.xls存在
Columns("A:A").Select >>>>>>選擇該工作表範圍
ActiveSheet.Paste 貼到該範圍
Windows("7271.xls").Activate
Columns("J:J").Select
Selection.Copy
Windows("BooK1").Activate
Columns("B:B").Select
ActiveSheet.Paste
Windows("7271.xls").Activate
Columns("S:S").Select
Selection.Copy
Windows("BooK1").Activate
Columns("C:C").Select
ActiveSheet.Paste
Windows("BooK1.xls").Activate
Range("D1").Select
ActiveCell.FormulaR1C1 = "B/C"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]/RC[-1]"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D24194"), Type:=xlFillDefault
Range("D2:D24194").Select
Range("E1").Select
ActiveCell.FormulaR1C1 = "取log 2為底"
Range("E2").Select
Columns("E:E").ColumnWidth = 10.25
Range("E2").Select
ActiveCell.FormulaR1C1 = "=LOG(RC[-1],2)"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E24194"), Type:=xlFillDefault
Range("E2:E24194").Select
Windows("7271.xls").Activate >>>>確定低一個XLS檔存在
ActiveWindow.Close >>>>>>>>關閉第一個XLS檔
Workbooks.OpenText Filename:="C:\exptsetno_901\7272.xls", StartRow:=27, _ >>>>>>>開啟第2個XLS檔
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
Columns("D:D").Select
Selection.Copy
Windows("BooK1").Activate >>>>確定BOOK1存在
Sheets.Add >>>>>>再BOOK1增加一個 工作表
Columns("A:A").Select
ActiveSheet.Paste
End Sub




ps 好像已經偏到office的 應用了 請幫我移版吧 不然有人會說閒話
thx

ivantw
2003-04-29, 02:01 AM
我繼續來問

我該如何 用巨集 讓他自己開一連串的 連續檔案

我要開1-114的檔 再我執行完一系列的事後 自己開檔

以下是我的 巨集 我要如何改

Sub Macro1()
'
' 巨集表
' 錄製的巨集
'

'
ChDir "C:\exptsetno_901"
Workbooks.OpenText Filename:="C:\exptsetno_901\7271.xls", StartRow:=27, _ >>>>>>>>>>這裡是說 開啟7271.xls檔,我共有114的xls 我將改成1編到114, 可以幫我血一個迴圈 讓他可以 做完我要求動作後自己開啟嚇一個檔嗎 郵1開始到114


, StartRow:=27, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
Columns("D:D").Select
Windows("BooK1").Activate >>>>>>>>我會將每個XLS檔的 要的內容存到BOOK1的工作表內 可以幫我血一個迴圈讓他可以 做好以下動作 換到下一個xls檔時就自己開一個book1的工作表嗎
Windows("7271.xls").Activate >>>>>轉換到第1個xls檔 確定該工作表存在 以繼續擷取動作
Columns("D:D").Select >>>>>>選擇該工作表範圍
Selection.Copy 複製該範圍
Windows("BooK1").Activate >>>>>>確定BOOK1.xls存在
Columns("A:A").Select >>>>>>選擇該工作表範圍
ActiveSheet.Paste 貼到該範圍
Windows("7271.xls").Activate
Columns("J:J").Select
Selection.Copy
Windows("BooK1").Activate
Columns("B:B").Select
ActiveSheet.Paste
Windows("7271.xls").Activate
Columns("S:S").Select
Selection.Copy
Windows("BooK1").Activate
Columns("C:C").Select
ActiveSheet.Paste
Windows("BooK1.xls").Activate
Range("D1").Select
ActiveCell.FormulaR1C1 = "B/C"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=RC[-2]/RC[-1]"
Range("D2").Select
Selection.AutoFill Destination:=Range("D2:D24194"), Type:=xlFillDefault
Range("D2:D24194").Select
Range("E1").Select
ActiveCell.FormulaR1C1 = "取log 2為底"
Range("E2").Select
Columns("E:E").ColumnWidth = 10.25
Range("E2").Select
ActiveCell.FormulaR1C1 = "=LOG(RC[-1],2)"
Range("E2").Select
Selection.AutoFill Destination:=Range("E2:E24194"), Type:=xlFillDefault
Range("E2:E24194").Select
Windows("7271.xls").Activate >>>>確定低一個XLS檔存在
ActiveWindow.Close >>>>>>>>關閉第一個XLS檔
Workbooks.OpenText Filename:="C:\exptsetno_901\7272.xls", StartRow:=27, _ >>>>>>>開啟第2個XLS檔
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1))
Columns("D:D").Select
Selection.Copy
Windows("BooK1").Activate >>>>確定BOOK1存在
Sheets.Add >>>>>>再BOOK1增加一個 工作表
Columns("A:A").Select
ActiveSheet.Paste
End Sub




ps 好像已經偏到office的 應用了 請幫我移版吧 不然有人會說閒話
thx

呃,不編排一下很難看懂...

purk
2003-05-05, 04:18 AM
ㄣ 這是資料分析的 新的東西 我寫了一大串 但是 不知道可以用變數直接取代嗎

另外 使用巨集的話 excel單一檔案的 大小 好像只能小於50MB
我不論如何設定 記憶體已經加到1g 還是會出現記憶體不足
不能儲存復原 然後出現錯誤 跳出偵錯畫面

thx

----------------------------------------------------------------------------------


Sub Macro1()
'
' 計算 巨集表
'
'

'
ChDir "C:\Documents and Settings\user\桌面"
Workbooks.Open Filename:="C:\Documents and Settings\user\桌面\Book1.xls"
Sheets("Sheet1").Select
Columns("E:E").Select
Selection.Copy
Windows("Book11.xls").Activate
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B1").Select
ActiveCell.FormulaR1C1 = "與A2的距離"
Range("B2").Select
ActiveCell.FormulaR1C1 = "=ABS((R2C[-1]^2)-RC[-1]^2)^0.5"
Selection.AutoFill Destination:=Range("B2:B50000")
Range("C2").Select
ActiveCell.FormulaR1C1 = "=ABS((R3C[-2]^2)-RC[-2]^2)^0.5"
Selection.AutoFill Destination:=Range("C2:C50000")
Range("D2").Select
ActiveCell.FormulaR1C1 = "=ABS((R4C[-3]^2)-RC[-3]^2)^0.5"
Selection.AutoFill Destination:=Range("D2:D50000")
Range("E2").Select
ActiveCell.FormulaR1C1 = "=ABS((R5C[-4]^2)-RC[-4]^2)^0.5"
Selection.AutoFill Destination:=Range("E2:E50000")
Range("F2").Select
ActiveCell.FormulaR1C1 = "=ABS((R6C[-5]^2)-RC[-5]^2)^0.5"
Selection.AutoFill Destination:=Range("F2:F50000")
Range("G2").Select
ActiveCell.FormulaR1C1 = "=ABS((R7C[-6]^2)-RC[-6]^2)^0.5"
Selection.AutoFill Destination:=Range("G2:G50000")
Range("H2").Select
ActiveCell.FormulaR1C1 = "=ABS((R8C[-7]^2)-RC[-7]^2)^0.5"
Selection.AutoFill Destination:=Range("H2:H50000")
Range("I2").Select
ActiveCell.FormulaR1C1 = "=ABS((R9C[-8]^2)-RC[-8]^2)^0.5"
Selection.AutoFill Destination:=Range("I2:I50000")
Range("J2").Select
ActiveCell.FormulaR1C1 = "=ABS((R10C[-9]^2)-RC[-9]^2)^0.5"
Selection.AutoFill Destination:=Range("J2:J50000")
Range("K2").Select
ActiveCell.FormulaR1C1 = "=ABS((R11C[-10]^2)-RC[-10]^2)^0.5"
Selection.AutoFill Destination:=Range("K2:K50000")
Range("L2").Select
ActiveCell.FormulaR1C1 = "=ABS((R12C[-11]^2)-RC[-11]^2)^0.5"
Selection.AutoFill Destination:=Range("L2:L50000")
Range("M2").Select
ActiveCell.FormulaR1C1 = "=ABS((R13C[-12]^2)-RC[-12]^2)^0.5"
Selection.AutoFill Destination:=Range("M2:M50000")
Range("N2").Select
ActiveCell.FormulaR1C1 = "=ABS((R14C[-13]^2)-RC[-13]^2)^0.5"
Selection.AutoFill Destination:=Range("N2:N50000")
Range("O2").Select
ActiveCell.FormulaR1C1 = "=ABS((R15C[-14]^2)-RC[-14]^2)^0.5"
Selection.AutoFill Destination:=Range("O2:O50000")
Range("P2").Select
ActiveCell.FormulaR1C1 = "=ABS((R16C[-15]^2)-RC[-15]^2)^0.5"
Selection.AutoFill Destination:=Range("P2:P50000")
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=ABS((R17C[-16]^2)-RC[-16]^2)^0.5"
Selection.AutoFill Destination:=Range("Q2:Q50000")
Range("R2").Select
ActiveCell.FormulaR1C1 = "=ABS((R18C[-17]^2)-RC[-17]^2)^0.5"
Selection.AutoFill Destination:=Range("R2:R50000")
Range("S2").Select
ActiveCell.FormulaR1C1 = "=ABS((R19C[-18]^2)-RC[-18]^2)^0.5"
Selection.AutoFill Destination:=Range("S2:S50000")
Range("T2").Select
ActiveCell.FormulaR1C1 = "=ABS((R20C[-19]^2)-RC[-19]^2)^0.5"
Selection.AutoFill Destination:=Range("T2:T50000")
Range("U2").Select
ActiveCell.FormulaR1C1 = "=ABS((R21C[-20]^2)-RC[-20]^2)^0.5"
Selection.AutoFill Destination:=Range("U2:U50000")
Range("V2").Select
ActiveCell.FormulaR1C1 = "=ABS((R22C[-21]^2)-RC[-21]^2)^0.5"
Selection.AutoFill Destination:=Range("V2:V50000")
Range("W2").Select
ActiveCell.FormulaR1C1 = "=ABS((R23C[-22]^2)-RC[-22]^2)^0.5"
Selection.AutoFill Destination:=Range("W2:W50000")
Range("X2").Select
ActiveCell.FormulaR1C1 = "=ABS((R24C[-23]^2)-RC[-23]^2)^0.5"
Selection.AutoFill Destination:=Range("X2:X50000")
Range("Y2").Select
ActiveCell.FormulaR1C1 = "=ABS((R25C[-24]^2)-RC[-24]^2)^0.5"
Selection.AutoFill Destination:=Range("Y2:Y50000")
Range("Z2").Select
ActiveCell.FormulaR1C1 = "=ABS((R26C[-25]^2)-RC[-25]^2)^0.5"
Selection.AutoFill Destination:=Range("Z2:Z50000")
Range("AA2").Select
ActiveCell.FormulaR1C1 = "=ABS((R27C[-26]^2)-RC[-26]^2)^0.5"
Selection.AutoFill Destination:=Range("AA2:AA50000")

End Sub