Problem 44949. Find the Best Hotels
You should mention that the answer should be given as a column vector, rather than row vector.
One at this time must examine the assessment code to give the right answer, while I think it should be self-contained in the question itself.
Thanks Richard. I have modified the problem description to mention this.
can anyone tell me the flaw in this code (im still very new to MATLAB)
function good = find_good_hotels(hotels,ratings,cutoff)
for c = 1:10 //the number 10 is a random number
if ratings(c) > cutoff | ratings(c) == cutoff
good = hotels(c);
else x = "not a good hotel"
@Kanishka, the question does not mention to return "not a good hotel", it only asks to return the names of hotels whose ratings is equalto or more than the threshold.
very good and challenging problem
Solution CommentsShow comments
Problem Recent Solvers6177
More from this Author13
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!