Could anyone help me to solve the issue.

I am having two matrices
A=[1.6512 1.6149 1.5829 1.5546 1.5298 1.1498 1.1334 1.1191 1.1066 1.0957 1.0862 1.0779 1.0707 1.0644 1.0589 1.0541 1.0499 1.0462 1.0430 1.0402 1.0377 1.0356 1.0337 1.0320 1.0305 1.0292 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198]
B=[ 2.7076 2.7629 2.7701 2.7939 2.7964 2.8101 2.8152 2.8153 2.8182 2.8183 2.8351 2.8389 2.8401 2.8483 2.8562 2.8581 2.8599 2.8638 2.8664 2.8691 2.8796 2.8817 2.8818 2.8841 2.8849 2.8849 5.2814 5.2834 5.2836 5.2875 5.2897 5.2946 5.3016 5.3102 5.3211 5.3254 5.3417 5.3484 5.3522]
Matrix A contains same value by reaching convergence after certain values.
I want to make matrix B to have the same value at the place where matrix A begins to have similar values .
Could anyone please help me on this

답변 (3개)

Raj
Raj 2019년 9월 13일

0 개 추천

A=[1.6512 1.6149 1.5829 1.5546 1.5298 1.1498 1.1334 1.1191 1.1066 1.0957 1.0862 1.0779 1.0707 1.0644 1.0589 1.0541 1.0499 1.0462 1.0430 1.0402 1.0377 1.0356 1.0337 1.0320 1.0305 1.0292 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198 1.0198];
B=[ 2.7076 2.7629 2.7701 2.7939 2.7964 2.8101 2.8152 2.8153 2.8182 2.8183 2.8351 2.8389 2.8401 2.8483 2.8562 2.8581 2.8599 2.8638 2.8664 2.8691 2.8796 2.8817 2.8818 2.8841 2.8849 2.8849 5.2814 5.2834 5.2836 5.2875 5.2897 5.2946 5.3016 5.3102 5.3211 5.3254 5.3417 5.3484 5.3522];
temp = findgroups(A);
B(temp(1))= A(temp(1));

댓글 수: 3

jaah navi
jaah navi 2019년 9월 13일
i am using matlab version 2015a when i run the code it gives error stating Undefined function or variable 'findgroups'.Could you please help me on it.
madhan ravi
madhan ravi 2019년 9월 13일
Desired result? How should it look like?
I want to have the B matrix in the following manner.
B=[2.7076 2.7629 2.7701 2.7939 2.7964 2.8101 2.8152 2.8153 2.8182 2.8183 2.8351 2.8389 2.8401 2.8483 2.8562 2.8581 2.8599 2.8638 2.8664 2.8691 2.8796 2.8817 2.8818 2.8841 2.8849 2.8849 5.2814 5.2814 5.2814 5.2814 5.2814 5.2814 5.2814 5.2814 5.2814 5.2814 5.2814 ]

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

Jos (10584)
Jos (10584) 2019년 9월 13일

0 개 추천

ix = find(abs(diff(A)) < YourThreshold, 1, 'first') % maybe you want to add + 1
B(ix:end) = B(ix)

댓글 수: 2

jaah navi
jaah navi 2019년 9월 13일
I ma using matlab version 2015a when i run the above command it gives error stating Undefined function or variable 'YourThreshold'.could you please help me on it.
Jos (10584)
Jos (10584) 2019년 9월 13일
You should set/replace YourThreshold to/by some value ... I also suggest you read the getting started section of Matlab first :-)

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

madhan ravi
madhan ravi 2019년 9월 13일

0 개 추천

Looks like it's the same as your previous question , why not use it then??
[~,~,c]=unique(A,'stable');
B = B(c)

댓글 수: 4

jaah navi
jaah navi 2019년 9월 13일
Yes you are correct.As the other experts gave another option i tried to work it out.
madhan ravi
madhan ravi 2019년 9월 13일
편집: madhan ravi 2019년 9월 13일
Please don’t ask the same question multiple times ? Is it like a habit? It indeed is daunting. It’s clear that you’re doing project which is important, but at the same time you need to be patient. Your total number of questions account to 213, but considering the unique cases it would only count below 50.
jaah navi
jaah navi 2019년 9월 13일
ok.
Rik
Rik 2019년 9월 13일
From previous questions is has become abundantly clear that Jaah and their colleague Prahba have some difficulty using this website. I have suggested multiple times they should ask someone for help that can come to their physical location and that speaks their native language.

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

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2019년 9월 13일

댓글:

2019년 9월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by