using splitapply on a table to split a column with repeating rows

Hello, I'm using splitapply but cannot seem to solve the following where I have an initial table as follows but want the final table. Fin_year is categorical, Type is categorical, but Quantity and the resulting City_quantity and Rural_quantity are numeric. Notice the repeating year row values in the initial table.

 採用された回答

Star Strider
Star Strider 2021 年 2 月 12 日

0 投票

See if the unstack function will do what you want.

4 件のコメント

Philip Chindamo
Philip Chindamo 2021 年 2 月 12 日
I get this error message: Variable index exceeds table dimensions.
Star Strider
Star Strider 2021 年 2 月 12 日
You will need to figure out what the problem is.
From the description in the documentation, it would appear to do what you want.
Philip Chindamo
Philip Chindamo 2021 年 2 月 12 日
yes thanks, was missing the quation marks, it works now.
Star Strider
Star Strider 2021 年 2 月 12 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Graphics Objects についてさらに検索

製品

リリース

R2020b

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by