MATLAB Answers

pick elements from an array

조회 수: 4(최근 30일)
guru k
guru k 2020년 3월 9일
댓글: Bhaskar R 2020년 3월 9일
I am having a array like
a=0:.1:10;
if I want to extract the elements from .5 to 0.8 to a new array how to do it?
I tried with find matlab command but it is giving only the ffirst elemnet 0.5 in the new array. but I need from 0.5 to 0.8
Kindly help in this regard

답변(1개)

Bhaskar R
Bhaskar R 2020년 3월 9일
new_a = a(a>=0.5 & a<=0.8);
  댓글 수: 2
Bhaskar R
Bhaskar R 2020년 3월 9일
y = x(x>=0.5 & x<=0.8).^2;
You are starting from 1 to 100 with 0.1 diff, it obviuos that output is empty

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

Community Treasure Hunt

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

Start Hunting!

Translated by