How to create Sub matrix(all 5*5) from a Matrix in MATLAB?

How to create Sub matrix(all 5*5) from a Matrix in MATLAB?

How to create Sub matrix(all 5*5) from a Matrix in MATLAB? This can be done by shifting exactly one row and one column.I have tried with following code but i'm not getting the actual output.Here A is the input matrix.

How to create Sub matrix(all 5*5) from a Matrix in MATLAB? This can be done by shifting exactly one row and one column.I have tried with following code but i'm not getting the actual output.Here A is the input matrix.

A=[40 45 50 60 70 80; 
    10 12 15 17 18 20; 
    35 41 57 44 98 78;
    45 74 11 2 36 78;
    12 45 79 85 36 45; 
    1 5 8 78 47 3]

for i=1:size(A,1)-4
for j=1:size(A,2)-4
B{i,j}=A(i:i+4,j:j+4)
end end

Now i,m getting this output:

A =

40 45 50 60 70 80 10 12 15 17 18 20 35 41 57 44 98 78 45 74 11 2 36 78 12 45 79 85 36 45 1 5 8 78 47 3

B = { [1,1] =

 40   45   50   60   70
 10   12   15   17   18
 35   41   57   44   98
 45   74   11    2   36
 12   45   79   85   36

} B = { [1,1] =

 40   45   50   60   70
 10   12   15   17   18
 35   41   57   44   98
 45   74   11    2   36
 12   45   79   85   36

[1,2] =

 45   50   60   70   80
 12   15   17   18   20
 41   57   44   98   78
 74   11    2   36   78
 45   79   85   36   45

} B = { [1,1] =

 40   45   50   60   70
 10   12   15   17   18
 35   41   57   44   98
 45   74   11    2   36
 12   45   79   85   36

[2,1] =

 10   12   15   17   18
 35   41   57   44   98
 45   74   11    2   36
 12   45   79   85   36
  1    5    8   78   47

[1,2] =

 45   50   60   70   80
 12   15   17   18   20
 41   57   44   98   78
 74   11    2   36   78
 45   79   85   36   45

[2,2] = } B = { [1,1] =

 40   45   50   60   70
 10   12   15   17   18
 35   41   57   44   98
 45   74   11    2   36
 12   45   79   85   36

[2,1] =

 10   12   15   17   18
 35   41   57   44   98
 45   74   11    2   36
 12   45   79   85   36
  1    5    8   78   47

[1,2] =

 45   50   60   70   80
 12   15   17   18   20
 41   57   44   98   78
 74   11    2   36   78
 45   79   85   36   45

[2,2] =

 12   15   17   18   20
 41   57   44   98   78
 74   11    2   36   78
 45   79   85   36   45
  5    8   78   47    3

}

But I need the output look like this:

40   45   50   60   70
10   12   15   17   18
35   41   57   44   98
45   74   11    2   36
12   45   79   85   36

45 50 60 70 80 12 15 17 18 20 41 57 44 98 78 74 11 2 36 78 45 79 85 36 45

10 12 15 17 18 35 41 57 44 98 45 74 11 2 36 12 45 79 85 36 1 5 8 78 47

12 15 17 18 20 41 57 44 98 78 74 11 2 36 78 45 79 85 36 45 5 8 78 47 3

What i have to change in my code?

matlab

What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Learn MATLAB Programming for Engineers | MATLAB Training

Learn to use MATLAB for problem solving, run scripts, write code and do data analysis and visualization, solve equations, do math operations and manipulate matrices, and formulate your own logic and convert complex problems into MATLAB code and solve them using programming skills.

MATLAB vs Python: Why and How to Make the Switch

Learn about MATLAB vs Python, why and how you should switch from MATLAB to Python. Evaluate the differences of using MATLAB vs Python. Convert scripts from MATLAB to Python. MATLABĀ® is widely known as a high-quality environment for any work that involves arrays, matrices, or linear algebra.

MATLAB Numpy element wise multiplication issue

Please see the MATLAB code and equivalent Numpy code below. Question: How can I get the D variable same in Numpy as MATLAB's?

Learn Machine Learning Classification Algorithms using MATLAB

Classification is a very interesting area of machine learning (ML). Learn the basics of MATLAB and understand how to use different machine learning algorithms using MATLAB, with emphasis on the MATLAB toolbox called statistic and machine learning toolbox. Learn the common classification algorithms.

Tutorial How to write MatLab functions in Python

A tutorial on writing MatLab-like functions using the Python language and the NumPy library.