HELLO!!!
kinda new to MATLAB, and I'm trying to figure out a way to ask the user to fill in a matrix and at the same time store something like a counter to know how many values are there in the matrix. from that, I could be able to find out if the number of values entered are odd or even, and how to absolute each value.
for example: input values: 9 -8 7 -6 5 these are odd numbers and there abs values are 9 8 7 6 5

 채택된 답변

dpb
dpb 2015년 12월 12일
doc input
>> x=input('Enter an array of values in []: ')
Enter an array of values in []: [1 2 3 -8 2:pi:12]
x =
1.0000 2.0000 3.0000 -8.0000 2.0000 5.1416 8.2832 11.4248
>> n=length(x)
n =
8
>> e=mod(x,2)==0
e =
0 1 0 1 1 0 0 0 0 0 0 0 0
>>
Read "Getting Started" section in documentation and work thru examples to get an overview of "how Matlab works"...

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기

제품

질문:

2015년 12월 12일

댓글:

2015년 12월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by