Hi,
I have a variable called P_rs which contains 96000x9801 (double). I'd like to divide it into smaller variables in multiples of 99 columns (below) and include all of these in a structure for easier save. Is there an easier way of doing this? (i.e. for loop etc.)
P_rs_01 = P_rs(:,1:99); P_rs_02 = P_rs(:,100:198); P_rs_03 = P_rs(:,199:297); P_rs_04 = P_rs(:,298:396); P_rs_05 = P_rs(:,397:495); P_rs_06 = P_rs(:,496:594); P_rs_07 = P_rs(:,595:693); P_rs_08 = P_rs(:,694:792); P_rs_09 = P_rs(:,793:891); P_rs_10 = P_rs(:,892:990); P_rs_11 = P_rs(:,991:1089); P_rs_12 = P_rs(:,1090:1188); P_rs_13 = P_rs(:,1189:1287); P_rs_14 = P_rs(:,1288:1386); P_rs_15 = P_rs(:,1387:1485); P_rs_16 = P_rs(:,1486:1584); P_rs_17 = P_rs(:,1585:1683); P_rs_18 = P_rs(:,1684:1782); P_rs_19 = P_rs(:,1783:1881); P_rs_20 = P_rs(:,1882:1980); P_rs_21 = P_rs(:,1981:2079); P_rs_22 = P_rs(:,2080:2178); P_rs_23 = P_rs(:,2179:2277); P_rs_24 = P_rs(:,2278:2376); P_rs_25 = P_rs(:,2377:2475); P_rs_26 = P_rs(:,2476:2574); P_rs_27 = P_rs(:,2575:2673); P_rs_28 = P_rs(:,2674:2772); P_rs_29 = P_rs(:,2773:2871); P_rs_30 = P_rs(:,2872:2970); P_rs_31 = P_rs(:,2971:3069); P_rs_32 = P_rs(:,3070:3168); P_rs_33 = P_rs(:,3169:3267); P_rs_34 = P_rs(:,3268:3366); P_rs_35 = P_rs(:,3367:3465); P_rs_36 = P_rs(:,3466:3564); P_rs_37 = P_rs(:,3565:3663); P_rs_38 = P_rs(:,3664:3762); P_rs_39 = P_rs(:,3763:3861); P_rs_40 = P_rs(:,3862:3960); P_rs_41 = P_rs(:,3961:4059); P_rs_42 = P_rs(:,4060:4158); P_rs_43 = P_rs(:,4159:4257); P_rs_44 = P_rs(:,4258:4356); P_rs_45 = P_rs(:,4357:4455); P_rs_46 = P_rs(:,4456:4554); P_rs_47 = P_rs(:,4555:4653); P_rs_48 = P_rs(:,4654:4752); P_rs_49 = P_rs(:,4753:4851); P_rs_50 = P_rs(:,4852:4950); P_rs_51 = P_rs(:,4951:5049); P_rs_52 = P_rs(:,5050:5148); P_rs_53 = P_rs(:,5149:5247); P_rs_54 = P_rs(:,5248:5346); P_rs_55 = P_rs(:,5347:5445); P_rs_56 = P_rs(:,5446:5544); P_rs_57 = P_rs(:,5545:5643); P_rs_58 = P_rs(:,5644:5742); P_rs_59 = P_rs(:,5743:5841); P_rs_60 = P_rs(:,5842:5940); P_rs_61 = P_rs(:,5941:6039); P_rs_62 = P_rs(:,6040:6138); P_rs_63 = P_rs(:,6139:6237); P_rs_64 = P_rs(:,6238:6336); P_rs_65 = P_rs(:,6337:6435); P_rs_66 = P_rs(:,6436:6534); P_rs_67 = P_rs(:,6535:6633); P_rs_68 = P_rs(:,6634:6732); P_rs_69 = P_rs(:,6733:6831); P_rs_70 = P_rs(:,6832:6930); P_rs_71 = P_rs(:,6931:7029); P_rs_72 = P_rs(:,7030:7128); P_rs_73 = P_rs(:,7129:7227); P_rs_74 = P_rs(:,7228:7326); P_rs_75 = P_rs(:,7327:7425); P_rs_76 = P_rs(:,7426:7524); P_rs_77 = P_rs(:,7525:7623); P_rs_78 = P_rs(:,7624:7722); P_rs_79 = P_rs(:,7723:7821); P_rs_80 = P_rs(:,7822:7920); P_rs_81 = P_rs(:,7921:8019); P_rs_82 = P_rs(:,8020:8118); P_rs_83 = P_rs(:,8119:8217); P_rs_84 = P_rs(:,8218:8316); P_rs_85 = P_rs(:,8317:8415); P_rs_86 = P_rs(:,8416:8514); P_rs_87 = P_rs(:,8515:8613); P_rs_88 = P_rs(:,8614:8712); P_rs_89 = P_rs(:,8713:8811); P_rs_90 = P_rs(:,8812:8910); P_rs_91 = P_rs(:,8911:9009); P_rs_92 = P_rs(:,9010:9108); P_rs_93 = P_rs(:,9109:9207); P_rs_94 = P_rs(:,9208:9306); P_rs_95 = P_rs(:,9307:9405); P_rs_96 = P_rs(:,9406:9504); P_rs_97 = P_rs(:,9505:9603); P_rs_98 = P_rs(:,9604:9702); P_rs_99 = P_rs(:,9702:9801);
Thanks

Réponses (1)

KSSV
KSSV le 19 Juil 2018

0 votes

Read about reshape. You can split your data into 3D matrices and use it later.
A = rand(96000,9801) ;
B = reshape(A,9600,99,[]) ;

Catégories

En savoir plus sur Simscape Driveline dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by