# Getting and calculating value from matrix

조회 수: 2(최근 30일)
Esra Demirbilek 2022년 3월 30일
편집: Mahmoud Ashraf 2022년 3월 30일
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?

댓글을 달려면 로그인하십시오.

### 답변(1개)

Mahmoud Ashraf 2022년 3월 30일
편집: Mahmoud Ashraf 2022년 3월 30일
Yy_new=[new_m(:,1) Yy]

댓글을 달려면 로그인하십시오.

### 범주

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by