Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to do a matrix from vectors

1 回表示 (過去 30 日間)
Valerio Gianforte
Valerio Gianforte 2020 年 2 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Good Afternoon,
I have to do a matrix starting from five vectors with the same dimensions but different class. Two vectors are "int32" and the other three are "single", when I do the matrix matlab converts the three vectors "single" to "int32" and approximates the values. Is there a way to convert "int32" or another way to do the matrix?
The first two vectors are "int32" while the last three are "single"
This is the method that I have adopted:
A = [time1 time2 Hs_buoy Tm_buoy Dm_buoy]

回答 (2 件)

Matt J
Matt J 2020 年 2 月 21 日
One way,
A=cell2mat( cellfun(@single,{time1 time2 Hs_buoy Tm_buoy Dm_buoy},'uni',0) )

Fangjun Jiang
Fangjun Jiang 2020 年 2 月 21 日
A = [single([time1 time2]) Hs_buoy Tm_buoy Dm_buoy]

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by