Clear Filters
Clear Filters

Getting and calculating value from matrix

2 views (last 30 days)
Hello everyone,
this is my code;
birincifazson: 37 25 12 45 3 32 41 ......
A1: 1 5 3 8 2 1 1 ......
.
.
.
...
resultt = birfazson(1,birfazson(2,:) == 1).'
new_m = [resultt birincisure(1,resultt).']
proctime=[birincisure(1,resultt).'] ;
Yy = zeros(numel(proctime),3);
Yy(:,1) = proctime(:,1);
Xx = cumsum(Yy(:,1));
Yy(2:end,2) = Xx(1:end-1);
Yy(:,3) = Xx(:);
and these are matrix outputs;
resultt ; new_m; Yy; Xx;
37 37 5 5 0 5 5
41 41 6 6 5 11 11
32 32 8 8 11 19 19
33 33 2 2 19 21 21
I made the operations for the 1 values ​​in the A1 line in the code part. I want to do the same operations for 2, 3 ,4...10 in row A1. And I want to print the obtained values ​​into Yy matrix . (next to the first job)
Also, I want to print the values 37,41,32,33 in new-m in matrix Yy.
like this:
37 5 0 5
41 6 5 11
32 8 11 19
33 2 19 21
How can I do it?
Thanks advence.

Answers (1)

Mahmoud Ashraf
Mahmoud Ashraf on 30 Mar 2022
Edited: Mahmoud Ashraf on 30 Mar 2022
Yy_new=[new_m(:,1) Yy]

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!