2282_zh-TW
創建數組我正在嘗試創建一個簡單的數組 a[1] = "string 1"..... a[10] = "string 10"
我通過從表中讀取值來創建這個數組,同時使用 FOR 語句進行循環。 我在第一次引用 a[1] 時遇到錯誤。 (實際上是一個j 已正確初始化並遞增。
我究竟做錯了什麼? 我嘗試尋求幫助,但沒有找到我要找的東西。
謝謝,回复:創建數組您不需要使用 For 循環來獲取列值。 使用 GET VALUES 可能會更快:
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">dt
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">=
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: rgb(0, 0, 221);">打開
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">(
style="font-size: 10pt; font-family: "快遞新"; color: Purple;">"$SAMPLE_DATA\Big
類.jmp"
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">)
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">;
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: green;">/*
引用列的兩種方法
顯示:
style="font-size: 10pt; font-family: "快遞新"; color: green;">
style="font-size: 10pt; font-family: "快遞新"; color: green;">
第一種方法很有用,如果
列名稱包含有趣的字符,例如斜線
style="font-size: 10pt; font-family: "快遞新"; color: green;">*/
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: black;">name_list
風格=“”>
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">=
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: rgb(0, 0, 221);">列
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">(
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">dt
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">,
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: Purple;">"名稱"
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">)
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;"><<
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
獲取值
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">;
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: black;">age_list
風格=“”>
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">=
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: rgb(0, 0, 221);">列
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">(
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">dt
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">,
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: Purple;">"年齡"
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">)
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;"><<
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
獲取值
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">;
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: green;">/*
如果該列是
簡單的名稱直接引用它*/
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: black;">sex_list
風格=“”>
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">=
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">:
style="font-size: 10pt; font-family: "快遞新"; color: black;">性別
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;"><<
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
獲取值
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">;
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: black;">height_list
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">=
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">:
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">高度
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;"><<
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
獲取值
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">;
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: black;">weight_list
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">=
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">:
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">重量
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;"><<
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
獲取值
style="font-size: 10pt; font-family: "快遞新"; color: 海軍藍;">;
style="font-size: 10pt; font-family: "快遞新"; color: 黑色;">
問候,
彼得回复:創建數組謝謝,這解決了我的問題!回复:創建數組您可能需要“a”作為列表。 嘗試在代碼前面添加一行: a = {};
然後查看“列表”、“關聯數組”和矩陣(或矩陣)的腳本 pdf 文檔。
Comments
There are no comments yet