![]() |
在這個頁面顯示本主題全部的 7 個文章 |
奇狐社區論壇 (http://www.chiefox.com.tw/bbs/index.php)
- 問題交流 (http://www.chiefox.com.tw/bbs/forumdisplay.php?forumid=28)
-- [求救]運算邏輯問題。 (http://www.chiefox.com.tw/bbs/showthread.php?threadid=18066)
[求救]運算邏輯問題。
各位前輩大家好:
1、請教,在迴圈由1到100,執行A=A+2,奇狐程式如何寫。
2:下列程式執行會出現指標數組下標越界或超出有效數據區間。^^?。請賜教,謝謝!
Price:=(High+Low)/2;
InPhase:=C*0;
Phase:=C*0;
AbsInPhase:=C*0;
Quadrature:=C*0;
DC:=datacount;
FOR i=1 to datacount do begin
LKB:=datacount-i;
if i >5 then begin
iValue1:=Price-ref(Price,6);
iValue2:=ref(iValue1,3);
iValue3:=0.75*(iValue1-ref(iValue1,6))+0.25*(ref(iValue1,2)-ref(iValue1,4));
IP33:=0.33*iValue2;
InPhase:=IP33;
IP67:=0.67*ref(InPhase,1);
InPhase:=IP33+IP67;
Qd2:=0.2*iValue3;
Quadrature:=Qd2;
Qd8:=0.67*ref(Quadrature,1);
Quadrature:=Qd2+Qd8;
AbsInPhase:=ABS(InPhase +ref(InPhase,1));
ABI:=AbsInPhase[0];
if ABI>0 then begin
A:5;
end;
end;
end;
回覆: [求救]運算邏輯問題。
引用:
最初由 winston_hsieh 發表
各位前輩大家好:
1、請教,在迴圈由1到100,執行A=A+2,奇狐程式如何寫。
2:下列程式執行會出現指標數組下標越界或超出有效數據區間。^^?。請賜教,謝謝!
Price:=(High+Low)/2;
InPhase:=C*0;
Phase:=C*0;
AbsInPhase:=C*0;
Quadrature:=C*0;
DC:=datacount;
FOR i=1 to datacount do begin
LKB:=datacount-i;
if i >5 then begin
iValue1:=Price-ref(Price,6);
iValue2:=ref(iValue1,3);
iValue3:=0.75*(iValue1-ref(iValue1,6))+0.25*(ref(iValue1,2)-ref(iValue1,4));
IP33:=0.33*iValue2;
InPhase:=IP33;
IP67:=0.67*ref(InPhase,1);
InPhase:=IP33+IP67;
Qd2:=0.2*iValue3;
Quadrature:=Qd2;
Qd8:=0.67*ref(Quadrature,1);
Quadrature:=Qd2+Qd8;
AbsInPhase:=ABS(InPhase +ref(InPhase,1));
ABI:=AbsInPhase[0];
if ABI>0 then begin
A:5;
end;
end;
end;
回覆: 回覆: [求救]運算邏輯問題。
引用:
最初由 cgjj 發表
Re1:
您所問的 A=A+2, A是數列嗎(陣列)? 還是單一數值?
Re2:
奇狐本身的數列並無第零個元素, 在奇狐當中它是自壹數起
故不會有 AbsInPhase[0] 這個元素
這段程式若是網路找來的, 它可能並非是奇狐所用的公式
(可能是其它與奇狐語法相似的軟體)
回覆: 回覆: 回覆: [求救]運算邏輯問題。
引用:
最初由 winston_hsieh 發表
一、抱歉,對奇狐語法陣列或單一數值的辨別方式不是很清楚,若A為陣列或單一數值的寫法各為何^^"?。
回覆: 回覆: 回覆: [求救]運算邏輯問題。
引用:
最初由 winston_hsieh 發表
二、是TS程式想轉奇狐,誠如總版主之前所說,各軟體有不同語法及執行方式。痛苦呀!>"<努力嘗試體會奇狐運作方式中。
若改為ABI:=AbsInPhase[i];執行還是會出現指標數組下標越界或超出有效數據區間。
若我需求只要AbsInPhase>0就進入判斷式那該如何寫!^^"謝謝!
感謝版主大大的指導,豁然開朗。感恩。^^y
引用:
最初由 winston_hsieh 發表
感謝版主大大的指導,豁然開朗。感恩。^^y
全部時間均為台灣時間, 現在時間為22:01 | 在這個頁面顯示本主題全部的 7 個文章 |
Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.
簡愛洋行 製作 Copyright 2003-. All Rights Reserved.