Effacer les filtres
Effacer les filtres

Why is my index obtained from 'getenv' not the correct number?

1 vue (au cours des 30 derniers jours)
Larissa Perez
Larissa Perez le 2 Déc 2019
Modifié(e) : Larissa Perez le 16 Déc 2019
I am running a Matlab code through a PBS Job Array. I need to run the same Matlab script 186 times. When I submit the job array I use the index J 1-186:1 and I use the function 'getenv' to insert this value into Matlab.
I ran a quick test with a Matlab code just print whatever I got from 'getenv' and it appeared to be working fine. When J = 1, it printed 1, etc.
However, when I actually run my entire code, it seems to be changing the index value. For example, when J = 1, it calls i = 49 for some reason. And then J = 2, it calls i = 50, etc...
Since I had run a test and it worked fine, I am assuming it is something to do with how I wrote my Matlab code:
close all
clear all
clc
i = getenv('PBS_ARRAY_INDEX');
%% Adding path and loading data
addpath (genpath('/30days/s4364336/CTb3_Turbulence'))
fn = {'t001','t002','t003','t004','t005','t006','t007','t008','t009','t010','t011',...
't012','t013','t014','t015','t016','t017','t018','t019','t020','t021','t022','t023',...
't024','t025','t026','t027','t028','t029','t030','t031','t032','t033','t034','t035','t036',...
't037','t038','t039','t040','t041','t042','t043','t044','t045','t046','t047','t048','t049','t050',...
't051','t052','t053','t054','t055','t056','t057','t058','t059','t060','t061','t062',...
't063','t064','t065','t066','t067','t068','t069','t070','t071','t072','t073','t074','t075',...
't076','t077','t078','t079','t080','t081','t082','t083','t084','t085','t086','t087','t088','t089',...
't090','t091','t092','t093','t094','t095','t096','t097','t098','t099','t100',...
't101','t102','t103','t104','t105','t106','t107','t108','t109','t110','t111',...
't112','t113','t114','t115','t116','t117','t118','t119','t120','t121','t122','t123',...
't124','t125','t126','t127','t128','t129','t130','t131','t132','t133','t134','t135','t136',...
't137','t138','t139','t140','t141','t142','t143','t144','t145','t146','t147','t148','t149','t150',...
't151','t152','t153','t154','t155','t156','t157','t158','t159','t160','t161','t162',...
't163','t164','t165','t166','t167','t168','t169','t170','t171','t172','t173','t174','t175',...
't176','t177','t178','t179','t180','t181','t182','t183','t184','t185','t186'};
tic
%% Load data - i is from the loop in the HPC
load(['CTb3_A1_', fn{i},'_ProcessedTurbulence.Struct.mat']);
Does anyone have any idea why this is happening? I tried running the same code, but shortening fn to t001 to t048. That gives me an error because it can't load the data (it looks for t049 straight away when J = 1).
Thanks!
Larissa

Réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by