2282_fr-FR
Création d'un tableauJ'essaie de créer un tableau simple a[1] = "string 1"..... a[10] = "string 10"
Je crée ce tableau en lisant les valeurs d'une table, tout en faisant une boucle avec une instruction FOR. Je reçois une erreur avec la première référence à a[1]. (en fait unet j est initialisé et incrémenté correctement.
Qu'est-ce que je fais mal? J'ai essayé d'aller à l'aide, mais je ne trouve pas ce que je cherche.
Merci,Re : Création d'un tableauVous n'avez pas besoin d'utiliser une boucle For pour obtenir les valeurs des colonnes. Peut-être plus rapide d'utiliser GET VALUES :
style="font-size: 10pt; font-family: "Courier New"; color: black;">dt
style="font-size: 10pt; font-family: "Courier New"; color: marine;">=
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">open
style="font-size: 10pt; font-family: "Courier New"; color: black;">(
style="font-size: 10pt; font-family: "Courier New"; color: purple;">"$SAMPLE_DATA\Big
Classe.jmp"
style="font-size: 10pt; font-family: "Courier New"; color: black;">)
style="font-size: 10pt; font-family: "Courier New"; color: marine;">;
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: green;">/*
Deux façons de référencer une colonne
sont indiqués:
style="font-size: 10pt; font-family: "Courier New"; color: green;">
style="font-size: 10pt; font-family: "Courier New"; color: green;">Le
première méthode est utile si le
le nom de la colonne contient des caractères amusants, comme une barre oblique
style="font-size: 10pt; font-family: "Courier New"; color: green;">*/
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">name_list
style="">
style="font-size: 10pt; font-family: "Courier New"; color: marine;">=
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">colonne
style="font-size: 10pt; font-family: "Courier New"; color: black;">(
style="font-size: 10pt; font-family: "Courier New"; color: black;">dt
style="font-size: 10pt; font-family: "Courier New"; color: marine;">,
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: purple;">"name"
style="font-size: 10pt; font-family: "Courier New"; color: black;">)
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: marine;"><<
style="font-size: 10pt; font-family: "Courier New"; color: black;">
obtenir des valeurs
style="font-size: 10pt; font-family: "Courier New"; color: marine;">;
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">age_list
style="">
style="font-size: 10pt; font-family: "Courier New"; color: marine;">=
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">colonne
style="font-size: 10pt; font-family: "Courier New"; color: black;">(
style="font-size: 10pt; font-family: "Courier New"; color: black;">dt
style="font-size: 10pt; font-family: "Courier New"; color: marine;">,
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: purple;">"age"
style="font-size: 10pt; font-family: "Courier New"; color: black;">)
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: marine;"><<
style="font-size: 10pt; font-family: "Courier New"; color: black;">
obtenir des valeurs
style="font-size: 10pt; font-family: "Courier New"; color: marine;">;
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: green;">/*
Si la colonne est une
nom simple il suffit de le référencer directement */
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">sex_list
style="">
style="font-size: 10pt; font-family: "Courier New"; color: marine;">=
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: marine;"> :
style="font-size: 10pt; font-family: "Courier New"; color: black;">sexe
style="font-size: 10pt; font-family: "Courier New"; color: marine;"><<
style="font-size: 10pt; font-family: "Courier New"; color: black;">
obtenir des valeurs
style="font-size: 10pt; font-family: "Courier New"; color: marine;">;
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">height_list
style="font-size: 10pt; font-family: "Courier New"; color: marine;">=
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: marine;"> :
style="font-size: 10pt; font-family: "Courier New"; color: black;">hauteur
style="font-size: 10pt; font-family: "Courier New"; color: marine;"><<
style="font-size: 10pt; font-family: "Courier New"; color: black;">
obtenir des valeurs
style="font-size: 10pt; font-family: "Courier New"; color: marine;">;
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: black;">weight_list
style="font-size: 10pt; font-family: "Courier New"; color: marine;">=
style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="font-size: 10pt; font-family: "Courier New"; color: marine;"> :
style="font-size: 10pt; font-family: "Courier New"; color: black;">weight
style="font-size: 10pt; font-family: "Courier New"; color: marine;"><<
style="font-size: 10pt; font-family: "Courier New"; color: black;">
obtenir des valeurs
style="font-size: 10pt; font-family: "Courier New"; color: marine;">;
style="font-size: 10pt; font-family: "Courier New"; color: black;">
Salutations,
PierreRe : Création d'un tableaumerci, cela a résolu mon problème!Re : Création d'un tableauVous avez probablement besoin de "a" pour être une liste. Essayez de faire précéder votre code d'une ligne : a = {} ;
Ensuite, jetez un coup d'œil dans les documents pdf de script pour "Lists", "Associative Arrays" et Matrices (ou Matrix).
Comments
There are no comments yet