Import data: com.mathworks.jmi.MatlabException: Arrays have incompatible sizes for this operation
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Piyush
am 11 Okt. 2023
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 Kommentare
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!