Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

# counting no .of temperature less than 32 in array

2 visualizzazioni (ultimi 30 giorni)
Abhishek singh il 3 Apr 2019
Chiuso: madhan ravi il 30 Ago 2020
function numfreeze = freezing(v)
count = 0;
i =v()
j = 32
if i < 32
count = count+1
numfreeze = count
else
end
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Abhishek singh il 3 Apr 2019
geeting errror
i =
45 21 32 31 51 12
j =
32
Output argument "numfreeze" (and maybe others) not assigned during call to "freezing".

### Risposte (6)

Ngei Katumo il 22 Ago 2019
function w = freezing (A)
w = sum (logical (A(A<32)));
end
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

madhan ravi il 3 Apr 2019
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 CommentiMostra 4 commenti meno recentiNascondi 4 commenti meno recenti
Image Analyst il 11 Giu 2019
You mean freezing.m, since that's what was asked.
madhan ravi il 15 Set 2019
Ah yes exactly:)

Nazneen Sayyad il 10 Giu 2019
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
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Ajith Thomas il 19 Lug 2019
function numfreeze=freezing(w)
lowerthan_32=w(w<32);
no_logical_values=lowerthan_32(lowerthan_32>=0);
numfreeze=length(no_logical_values);
end
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Ajith Thomas il 19 Lug 2019
function numfreeze=freezing(w)
lowerthan_32=w(w<32);
numfreeze=numel(lowerthan_32);
end

Roshan Singh il 15 Set 2019
function numfreeze = freezing(x)
f = x(x<32);
numfreeze = length(f);
end
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

MADHURJYA DAS il 30 Ago 2020
function numfreeze=freezing(A)
x=(A<32);
numfreeze=sum(x(:));
end
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Questa domanda è chiusa.

R2015b

### Community Treasure Hunt

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

Start Hunting!

Translated by