Logical Operator with cell
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have done this code and I would like to enshorten it. Do you have a suggestion?
Indexn = strfind(reg_freight_train(:,3),'ITC');
c = find(not(cellfun('isempty',Indexn)));
reg_train_LD_ita =reg_freight_train(c,:);
LOAD=str2double(reg_train_LD_ita(:,5:size(reg_train_LD_ita,2)));
Indexn = strfind(reg_freight_train(:,3),'ITD');
c = find(not(cellfun('isempty',Indexn)));
reg_train_LD_ita =reg_freight_train(c,:);
LOAD=[LOAD ; str2double(reg_train_LD_ita(:,5:size(reg_train_LD_ita,2)))];
Indexn = strfind(reg_freight_train(:,3),'ITH');
c = find(not(cellfun('isempty',Indexn)));
reg_train_LD_ita =reg_freight_train(c,:);
LOAD=[LOAD ; str2double(reg_train_LD_ita(:,5:size(reg_train_LD_ita,2)))];
0 commentaires
Réponses (1)
Voss
le 14 Déc 2023
names = {'ITC','ITD','ITH'};
LOAD = [];
for ii = 1:numel(names)
LOAD = [LOAD; str2double(reg_freight_train(contains(reg_freight_train(:,3),names{ii}),5:end))];
end
0 commentaires
Voir également
Catégories
En savoir plus sur Encryption / Cryptography dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!