Hello every one my problem is in output.
z=[6
21
36]
but ı want to z as
z=[4
21
12]
how can ı fix this problem.Thanks for your answer and the file Untitled2.m uploaded.

 채택된 답변

KSSV
KSSV 2021년 5월 5일

0 개 추천

x=[1 2 3 4 5
6 7 8 9 10
11 12 13 14 15];
a=1;
b=2;
c=3;
z = zeros(3,1) ;
idx = x(:,1)<3 ;
z(idx) = x(idx,2)*b ;
idx = x(:,1) >= 3 & x(:,1) < 7 ; % 3<= x(:,1)<7
z(idx) = x(idx,2)*c ;
idx = x(:,1) > 7 ;
z(idx) = x(idx,2)*a ;

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

질문:

2021년 5월 5일

답변:

2021년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by