boxplot vs column of strings

조회 수: 1 (최근 30일)
in-p
in-p 2015년 4월 17일
편집: in-p 2015년 4월 24일
So, i need to analyse some data regarding 4 precipitation stations. Problem is, each station gives me a different number of values than the other stations, so I can't use boxplot with multiple variables. I'm trying to solve this by creating one unic column with the results from the four stations (that part is easy and it's done), but I can't find out a way of creating a column of strings with the stations names.
example: station 1 gives me 1 value, station 2 gives me 2 values, station 3 gives me 3, station 4 gives me 4. I want a column like:
station 1
station 2
station 2
station 3
station 3
station 3
station 4
station 4
station 4
station 4
help? thanks!

답변 (1개)

Tom Lane
Tom Lane 2015년 4월 18일
The simplest way to do this would depend on how you have your data stored now. For example, do you already have it as a column of station numbers? Then this is relatively simple:
>> names = {'first'; 'second'; 'third'};
>> numbers = [1 3 2 3 1]';
>> g = names(numbers)
g =
'first'
'third'
'second'
'third'
'first'
  댓글 수: 1
in-p
in-p 2015년 4월 24일
편집: in-p 2015년 4월 24일
I have the station names as inputs from a prompt function. (station1=char(answer(1)) and so on), and I already know how many values wich station has (n1=54, etc), just don't know how to get it all together... Any idea?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by