"Arrays have incompatible sizes for this operation" error

조회 수: 16 (최근 30일)
Jacey
Jacey 2024년 6월 3일
댓글: Steven Lord 2024년 6월 3일
As you can see in the attached photo, all of my arrays have the same size (3600 x 3601). So, I don't understand how I keep getting this error.

답변 (1개)

the cyclist
the cyclist 2024년 6월 3일
It's difficult to know for sure, but I'm guessing those are the variables as they exist in the workspace, outside the function.
Inside the function, you are loading the variables. Are you sure they are all the same size inside of those *.MAT files? Try putting a breakpoint at line 11 of your code, and see what the variable sizes are there.
Can you upload the files here (and your actual code, not a screenshot), so we can try?
  댓글 수: 7
Jacey
Jacey 2024년 6월 3일
Okay, but I don't know how to resample my data where the height and width will be changed to the correct values. I did not create the array manually. My array (the one with the off dimensions) was created from data from a GeoTiff file that I am not able to change.
I don't know. Maybe it's a lost cause.
Steven Lord
Steven Lord 2024년 6월 3일
Take a look at the imresize function and/or this example from the interpolation documentation. If you're using Mapping Toolbox there may be functions you can use in that product as well, ones that are designed specifically for working with geographic data. Maybe georesize?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by