MATLAB Answers

Data from multiple cells into one cell

5 views (last 30 days)
Linus Dock
Linus Dock on 7 Oct 2016
Commented: Linus Dock on 7 Oct 2016
Hi! I have a number of cells with data in multiple rows of strings that I would like to merge into one cell. If I would do it manually it would look like this:
UtData=[Utmetar{1};Utmetar{2}]
But the number of cells is about 100 and increasing with time so I would like to do this iteratively. Is there a way of doing this in a loop or in any other way?
The output from the cell
Utmetar{1} looks like this:
'METAR ESDF 200808311920Z 10008KT 9999 BKN037 14/10 Q1022'
'METAR ESDF 200808311950Z 09005KT 9999 FEW034 14/10 Q1022'
'METAR ESDF 200808312020Z 09003KT 060V130 CAVOK 13/10 Q1022'
'METAR ESDF 200808312050Z AUTO 09003KT 9999NDV NCD 12/09 Q1022'
... and so on
And Utmetar looks like this at the moment:
Utmetar =
Columns 1 through 5
{1255x1 cell} {1487x1 cell} {1447x1 cell} {1464x1 cell} {1433x1 cell}
Column 6
{1500x1 cell}

Answers (1)

uu tsi
uu tsi on 7 Oct 2016
I think you can use end + 1
ex:
a = {}
while true
a{end + 1} = rand(randi(5))
end
  1 Comment
Linus Dock
Linus Dock on 7 Oct 2016
Hi, I can't get this to function properly, is there any other way?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by