Vertcat Error in creating a junction

2 views (last 30 days)
Joshua
Joshua on 19 Dec 2024
Edited: Ayush on 22 Dec 2024
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 Comment
Walter Roberson
Walter Roberson on 19 Dec 2024
Error using importdata (line 71)
Unable to open file.
Error in
Create_BNJunction_OP (line 20)
bnnt_L = importdata('bnnt_L.xyz', ' ',4);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sign in to comment.

Answers (1)

Ayush
Ayush on 22 Dec 2024
Edited: Ayush on 22 Dec 2024
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!

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Tags

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!