Vertcat Error in creating a junction
2 次查看(过去 30 天)
显示 更早的评论
I will attatch the code I am having a problem with but the jist of it is that I am having a vertcat error and can't seem to solve the problem. I am using imported files since this is for a boron-nitride structure, could those be affecting the code?
1 个评论
Walter Roberson
2024-12-19
Error using importdata (line 71)
Unable to open file.
Error in
Create_BNJunction_OP (line 20)
bnnt_L = importdata('bnnt_L.xyz', ' ',4);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
回答(1 个)
Ayush
2024-12-22
编辑:Ayush
2024-12-22
In order to investigate the error, you need to provide the required files such as 'bnnt_L.xyz' as running your code is giving the error: "Unable to open file".
However here are some potential cause of "vertcat" error.
This issue occurs when trying to concatenate arrays with incompatible sizes. Given that you're using imported files (bnnt_L.xyz, bnnt_R.xyz, bnnt_M.xyz, etc.), it's likely that the structure of the data in these files could be causing the issue.
So, as you are concatenating multiple data arrays (bnnt_L, bnnt_R, bnnt_M, etc.), and if one of these arrays doesn't have the same number of columns or rows, it can cause a vertcat error.
To debug the issue, you can use "size" function to check the dimensions of your matrices after importing them. You can read more about it here: https://www.mathworks.com/help/matlab/ref/double.size.html
Hope it helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!