SHould i use a switch or class

4 ビュー (過去 30 日間)
fadams18
fadams18 2019 年 7 月 11 日
コメント済み: Adam Danz 2019 年 7 月 11 日
Hello matlabers,
So I have a question.
so i have 3 types of vehicles repressinting [0,1,2] i.e. 0 ='normal car', 1='emergency' and 2='pedestrain'
I want to write a program that alerts any type of those cars if another car is approaching it. eg. if emergency is at its station and pedestrain car is approacing it sends a message saying ''pedestrian car appoaching'' and the pedestrian car says "approaching emergency car".
Please help me guys thank you.
  10 件のコメント
Guillaume
Guillaume 2019 年 7 月 11 日
Ok, there are many cars (thousands? millions?). You still haven't told us what the inputs of your program are, nor what your program does.
  • Your program could be a simulation of 1000s (millions?) of cars moving about. In which case, it needs to track all the car positions, all the time.
  • Your program could be a real-time detection program running in your own car. In which case, the structure is completely different, the inputs are just, there's a car of type X or there's no car.
  • It could be something else completely different.
Adam Danz
Adam Danz 2019 年 7 月 11 日
@fadams18, a little bit of time spent formalizing your problem and mapping out a plan for your program will potentially save hours, days, or weeks of writing and re-writing it on a whim.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by