奇狐社區論壇
在這個頁面顯示本主題全部的 7 個文章

奇狐社區論壇 (http://www.chiefox.com.tw/bbs/index.php)
- 問題交流 (http://www.chiefox.com.tw/bbs/forumdisplay.php?forumid=28)
-- [問題]ubound用法 (http://www.chiefox.com.tw/bbs/showthread.php?threadid=22895)


由 estockcat 在 2021-03-30 11:55 發表:

[問題]ubound用法

盈虧:barslast(barpost=0);
ubound(c); //值2035

盈虧[ubound(c)] ; //出現錯誤,無法編輯

盈虧[2035];


//要顯示盈虧運算值 ,只有盈虧[2035]看的到數值
請教版大要怎麼寫?


由 cgjj 在 2021-03-30 12:10 發表:

回覆: [問題]ubound用法

引用:
最初由 estockcat 發表
盈虧:barslast(barpost=0);
ubound(c); //值2035

盈虧[ubound(c)] ; //出現錯誤,無法編輯

盈虧[2035];


//要顯示盈虧運算值 ,只有盈虧[2035]看的到數值
請教版大要怎麼寫?



盈虧:barslast(barpost=0);

應修正為

盈虧:barslast(barpos=0);


由 estockcat 在 2021-03-30 12:14 發表:

barpos=0
是放的時候打錯字。

程式沒錯。
重點不是那裡。

盈虧[ubound(c)];沒法用?


由 cgjj 在 2021-03-30 12:19 發表:

引用:
最初由 estockcat 發表
barpos=0
是放的時候打錯字。

程式沒錯。
重點不是那裡。

盈虧[ubound(c)];沒法用?



盈虧:barslast(barpos=0);
這是將 盈虧這個變數,先設成無效數列
後續尚未賦值前,不應該用盈虧[n] 去存取它


由 cgjj 在 2021-03-30 12:36 發表:

無效數列並非零值數列

若您要將盈虧弄成零值數列,做法如下:
盈虧:C*0;

ubound(c) 結果跟 datacount 是一樣的值
故 盈虧[ubound(c)] 可寫為 盈虧[datacount]

盈虧[ubound(c)] 能不能正常跑
關鍵在於 "盈虧" 必須為有效數列,盈虧[n] 中的 n 必須在盈虧數列的有效範圍內
若盈虧為無效數列,就不可用 盈虧[n] 來存取


由 estockcat 在 2021-03-30 12:42 發表:

微笑

瞭解差異了。謝謝版大。


由 cgjj 在 2021-03-30 13:07 發表:

引用:
最初由 estockcat 發表
瞭解差異了。謝謝版大。


不客氣^^


全部時間均為台灣時間, 現在時間為06:30
在這個頁面顯示本主題全部的 7 個文章


Powered by: vBulletin Version 2.3.0 - Copyright©2000-, Jelsoft Enterprises Limited.

簡愛洋行 製作 Copyright 2003-. All Rights Reserved.