how i can combine two arrays which are in same dimension

2 ビュー (過去 30 日間)
bishop Rab
bishop Rab 2018 年 3 月 8 日
コメント済み: bishop Rab 2018 年 3 月 9 日
date01 % array contains date and time like this '09/01/2015 00:30:00'
size(date01) =3565 1
press % array contains values of pressure like this 5.215
size(press) =3565 1
when i try to combine this two arrays in one matrices like
prm=[date01 press]
i got
error using horzcat
Dimensions of matrices being concatenated are not consistent
i need your help plz
thank you

採用された回答

Star Strider
Star Strider 2018 年 3 月 8 日
You cannot combine string and numeric arrays in a numeric array.
You must use a cell array:
date_01 = '09/01/2015 00:30:00';
press = 5.215;
prm = {date_01 press}
prm =
1×2 cell array
{'09/01/2015 00:30:00'} {[5.2150e+000]}
This should work for your arrays as it did for these two scalars.
You can also combine them in a table.
  1 件のコメント
bishop Rab
bishop Rab 2018 年 3 月 9 日
Thanks,well i need this data in a matrix to use it after in plots or inside Matlab expressions,even with your suggestion it did not work for me.my data are in text file that contains date,time,and values...i'm really stuck in this pblm....the date and time is a serious issue for me

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

その他の回答 (1 件)

KSSV
KSSV 2018 年 3 月 8 日
use vertcat
  1 件のコメント
bishop Rab
bishop Rab 2018 年 3 月 8 日
did not work,the two arrays are the same size,when i use vertcat it gives me another array with one columns
prm=vertcat(data01 press)
size(prm)= 3566 1
i'm suppose to have a size like 3565 2, i need it in two columns

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

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by