How to join datasets?
1 次查看(过去 30 天)
显示 更早的评论
I need to join some columns in the dataset attached below. When I joined the columns int_rate and id with the following code, it works.
TrainInputs = [TrainDataset.int_rate,TrainDataset.id]
But when I was trying to join the columns int_rate and sub_grade, it failed.
TrainInputs = [TrainDataset.int_rate,TrainDataset.sub_grade]
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Could you help me find out why and how should I do this? Thank you for your time.
0 个评论
回答(1 个)
Muhammad Usman Saleem
2016-6-18
check this in both columns vectors, these are not of same length.
TrainDataset.int_rate and TrainDataset.id are not of same length to concatenated. Always concatenate vector of same lengths
2 个评论
Muhammad Usman Saleem
2016-6-19
You can't horizontally concatenate scalars with matrices or column vector, hence the error.
Find out which variable is the culprit on why it's not scalar (or why you're using a non-scalar variable in your expression.
As i do not know how you three column vectors looks, The attached .m file also not opening. Please upload here its content
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!