Import data: com.mathworks.jmi.MatlabException: Arrays have incompatible sizes for this operation
3 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I want to import a huge .csv file recoursively with a script that I'm writing. In order to understand the best script to import the data I used the "Import data" function in the "Home" tab in Matlab.
I attached here a small version of the input file. If you try to open it with excel (just to check what the imput is) you'll find out that the first 7th rows are actually the headerline and excel can't allign it in only one row. The 8th and 9th rows, instead, are the corresponding data.
Now, "Import data" is not even able to open the preview since it says "com.mathworks.jmi.MatlabException: Arrays have incompatible sizes for this operation.".
Any suggestion?
Thanks,
Luca
0 件のコメント
回答 (1 件)
Piyush
2023 年 10 月 11 日
Hi @Luca D'Angelo,
I understand that you are facing trouble loading your '.csv' dataset in MATLAB. The dimension of the dataset is such that the first seven rows comprise of the headerline whereas the actual data begins from the 8th row. You also witness that importing the data into MATLAB does not even display the preview but throws an exception, "com.mathworks.jmi.MatlabException: Arrays have incompatible sizes for this operation."
I tried reproducing the issue on my end but I am able to load the excel file without any issues. The loaded table is in the same format where the first 7 rows has the headerline data and with same sparsity as available in dataset. You may prefer updating MATLAB to the latest version which includes various bug fixes and thereby allowing you to load the dataset without any issues. Once the data has been loaded into the MATLAB session you can use the "reshape" function to structure the matrix by explicitly specifying the dimension and achieving the goal of having the seven rows as single row headerline.
Please refer to the following MathWorks documentation link for more information on "reshape":
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Import from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!