Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

counting no .of temperature less than 32 in array

조회 수: 1 (최근 30일)
Abhishek singh
Abhishek singh 2019년 4월 3일
마감: madhan ravi 2020년 8월 30일
function numfreeze = freezing(v)
count = 0;
i =v()
j = 32
if i < 32
count = count+1
numfreeze = count
else
end
  댓글 수: 1
Abhishek singh
Abhishek singh 2019년 4월 3일
geeting errror
i =
45 21 32 31 51 12
j =
32
Output argument "numfreeze" (and maybe others) not assigned during call to "freezing".

답변 (6개)

Ngei Katumo
Ngei Katumo 2019년 8월 22일
function w = freezing (A)
w = sum (logical (A(A<32)));
end

madhan ravi
madhan ravi 2019년 4월 3일
v=[45 21 32 31 51 12];
threshold=32;
numfreeze = freezing(v,threshold) % function call
function numfreeze = freezing(v,threshold) % function definition
numfreeze = nnz(v<threshold);
end
  댓글 수: 6
Image Analyst
Image Analyst 2019년 6월 11일
You mean freezing.m, since that's what was asked.
madhan ravi
madhan ravi 2019년 9월 15일
Ah yes exactly:)

Nazneen Sayyad
Nazneen Sayyad 2019년 6월 10일
Write a function called freezing that takes a vector of numbers that correspond to daily low temperatures in Fahrenheit. Return numfreeze, the number of days with sub freezing temperatures (that is, lower than 32 F) without using loops. Here is an example run:
numfreeze = freezing([45 21 32 31 51 12])
numfreeze =
3
function numfreeze = freezing(A)
B=A(A<32);
numfreeze=numel(B);
end

Ajith Thomas
Ajith Thomas 2019년 7월 19일
function numfreeze=freezing(w)
lowerthan_32=w(w<32);
no_logical_values=lowerthan_32(lowerthan_32>=0);
numfreeze=length(no_logical_values);
end
  댓글 수: 1
Ajith Thomas
Ajith Thomas 2019년 7월 19일
function numfreeze=freezing(w)
lowerthan_32=w(w<32);
numfreeze=numel(lowerthan_32);
end

Roshan Singh
Roshan Singh 2019년 9월 15일
function numfreeze = freezing(x)
f = x(x<32);
numfreeze = length(f);
end

MADHURJYA DAS
MADHURJYA DAS 2020년 8월 30일
function numfreeze=freezing(A)
x=(A<32);
numfreeze=sum(x(:));
end

이 질문은 마감되었습니다.

태그

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by