Info

This question is closed. Reopen it to edit or answer.

i want to store all the values of intensity and all the plots for each run from n=1:10 for the following code ?how do i modify the code

1 view (last 30 days)
  1. * load allrains.txt
  2. * y=allrains(:,:);
  3. * rain=data1(:,:);
  4. * data=data1(:,1:10);
  5. * for n=1:size(data,2)
  6. * dataA=[];
  7. * for i=1:length(rain)-2
  8. * dataA=[dataA; sum(data(i:i+2,n))];
  9. * end
  10. * dataB=[];
  11. * for i=1:length(rain)-5
  12. * dataB=[dataB; sum(data(i:i+5,n))];
  13. * end
  14. * dataC=[];
  15. * for i=1:length(rain)-8
  16. * dataC=[dataC; sum(data(i:i+8,n))];
  17. * end
  18. * dataD=[];
  19. * for i=1:length(rain)-11
  20. * dataD=[dataD; sum(data(i:i+11,n))];
  21. * end
  22. * dataF=[];
  23. * for i=1:length(rain)-14
  24. * dataF=[dataF; sum(data(i:i+14,n))];
  25. * end
  26. * dataG=[];
  27. * for i=1:length(rain)-17
  28. * dataG=[dataG; sum(data(i:i+17,n))];
  29. * end
  30. * dataK=[]
  31. * for i=1:length(rain)-20
  32. * dataK=[dataK; sum(data(i:i+20,n))];
  33. * end
  34. *
  35. * dataH=[];
  36. * for i=1:length(rain)-23
  37. * dataH=[dataH; sum(data(i:i+23,n))];
  38. * end
  39. * dataI=[];
  40. * for i=1:length(rain)-35
  41. * dataI=[dataI; sum(data(i:i+35,n))];
  42. * end
  43. * dataJ=[];
  44. * for i=1:length(rain)-47
  45. * dataJ=[dataJ; sum(data(i:i+47,n))];
  46. * end
  47. *
  48. * % % Make padded array.....
  49. * M = nan(length(rain),10);
  50. * M(3:length(data),1) = dataA;
  51. * M(6:length(data),2) = dataB;
  52. * M(9:length(data),3) = dataC;
  53. * M(12:length(data),4) = dataD;
  54. * M(15:length(data),5) = dataF;
  55. * M(18:length(data),6) = dataG;
  56. * M(21:length(data),7) = dataK;
  57. * M(24:length(data),8) = dataH;
  58. * M(36:length(data),9) = dataI;
  59. * M(48:length(data),10) = dataJ;
  60. * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  61. * year=y(:,1);
  62. * dataset=[year M];
  63. * [years, ~, gg] = unique(dataset(:, 1));
  64. * dataset1=[gg M];
  65. * MaxC=[];
  66. * for i=1:31
  67. *
  68. * for k1 = 2:size(dataset,2)
  69. * maxd = max(dataset(gg==i,k1));
  70. * MaxCol(k1,:) = maxd;
  71. * end
  72. * MaxC=[MaxC MaxCol];
  73. * end
  74. * MaxC =(MaxC(2:end,:))';
  75. * mm=mean(MaxC,1);
  76. * stdev=std(MaxC,1);
  77. * recurrence=[2;5;10;25;50;100];
  78. * KT=[];
  79. * for i=1:length(recurrence)
  80. * gumbell_kt(i)=-(sqrt(6))/pi*(0.5772+log(log(recurrence(i)/(recurrence(i)-1))));
  81. * end
  82. * KT=[KT gumbell_kt];
  83. * KT=KT';
  84. * dataarrange=[mm' stdev'];
  85. * for i=1:length(dataarrange)
  86. * for j=1:length(KT)
  87. * table(i,j)=dataarrange(i,1)+KT(j).*dataarrange(i,2);
  88. * end
  89. * end
  90. * duration=[3;6;9;12;15;18;21;24;36;48];
  91. * for i=1:length(duration)
  92. * for j=1:length(KT)
  93. * intensity(i,j)=table(i,j)./duration(i);
  94. * end
  95. * end
  96. * PLOT(n)=plot(duration,intensity(:,1),'bd-',duration,intensity(:,2),'gd-',duration,intensity(:,3),'cd-',duration,intensity(:,4),'kd-',duration,intensity(:,5),'md-',duration,intensity(:,6),'yd-');
  1 Comment
Image Analyst
Image Analyst on 4 Jul 2018
Read this link to make it easy for us to answer you.
Don't double space your code but instead read this link.
Lastly, you forgot to attach allrains.txt with the paper clip icon.

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!