フィルターのクリア

How to combine two variables in a table

4 ビュー (過去 30 日間)
012786534
012786534 2020 年 1 月 20 日
コメント済み: Cameron B 2020 年 1 月 20 日
Hi,
I simply want to combine two variables (mean and sd) into a single variable with the symbol ± in between numbers.
mean = {1,2,3,4,5,6,7,8,9}.';
sd = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}.';
t = table(mean, sd);
t.output = {'1±0.1', '2±0.2', '3±0.3', '4±0.4', '5±0.5', '6±0.6', '7±0.7', '8±0.8', '9±0.9'}.';
The desired output is t.output.
Thank you,

回答 (1 件)

Cameron B
Cameron B 2020 年 1 月 20 日
You should rename your value called mean as something that is not already a function name.
meanval = {1,2,3,4,5,6,7,8,9}.';
sd = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}.';
t = {strcat(num2str(cell2mat(meanval)),'±',num2str(cell2mat(sd)))};
  2 件のコメント
012786534
012786534 2020 年 1 月 20 日
Indeed, I should rename the mean variable.
I think there's something with your output: '123456789±±±±±±±±±000000000.........123456789'
Thank you,
Cameron B
Cameron B 2020 年 1 月 20 日
Hmm when I type t{1}(1,:) it gives 1±0.1. I am on the mobile app so that may be different.

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

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by