From b5fb0790fd8c2820eae6c153bf7cd88beeaa0aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 19 Nov 2019 13:43:13 +0100 Subject: Add get_bars_from_values-function --- Kod/bilbana/yc4/display/get_bars_from_values.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Kod/bilbana/yc4/display/get_bars_from_values.m diff --git a/Kod/bilbana/yc4/display/get_bars_from_values.m b/Kod/bilbana/yc4/display/get_bars_from_values.m new file mode 100644 index 0000000..ff08075 --- /dev/null +++ b/Kod/bilbana/yc4/display/get_bars_from_values.m @@ -0,0 +1,22 @@ +function bars = get_bars_from_values(values1, values2) +bars = []; +for i = 1:9 + bar = struct; + bar.x_lo = 16 + 13 + (30 * i); + bar.x_hi = bar.x_lo; + bar.y_lo = 200; + bar.y_hi = round(152 * (values1(i) / max(values1))); + if isempty(values2) + bar.x_hi = bar.x_lo + 20; + bars = [bars bar1] + else + bar.x_hi = bar.x_lo + 10; + bar2 = struct; + bar2.x_lo = bar.x_lo + 10; + bar2.x_hi = bar2.x_hi + 10; + bar2.y_lo = 200; + bar2.y_hi = round(152 * (values2(i) / max(values2))); + bars = [bars bar1 bar2] + end +end +end -- cgit v1.2.1