Flipping a Matrix
Flipping matrix up and down.
If a central row is exists, leave it, and flip remaining rows.
Example
Mat = magic(3)
...
4ヶ月 前
解決済み
Swap two numbers
Example
Input:
a = 10
b = 20
Output
a = 20
b = 10
4ヶ月 前
解決済み
Half-Swap
Given a vector with an even number of elements,
rearrange it so that the elements in its first
half are switched with those i...
4ヶ月 前
解決済み
Matlab Basics - Switching Assignments
Switch assignments for variables x and y, for example
start with x = 1 and y = 3
end with y = 1 and x = 3
Do NOT simply r...
4ヶ月 前
解決済み
Swap between columns
The idea is to swap between second and second last column
Ex = [1 2 3 4 5;
1 2 3 4 5;
1 2 3 4 5;
1 2 3 4 5;
...
4ヶ月 前
解決済み
Remove a specific character with another
Remove any (-) dash sign with (_) underscore
Ex = 'The-Journey-of-thoudsands-miles-starts-with-a-single-step'
y = 'The_Jour...
4ヶ月 前
解決済み
Swap between first and last
The idea is to swap between first and last row
Ex = [1 2 3 4 5;
1 2 3 4 5;
1 2 3 4 5;
1 2 3 4 5;
...
4ヶ月 前
解決済み
Swap between first and last column
The idea is to swap between first and last column
Ex = [1 2 3 4 5;
1 2 3 4 5;
1 2 3 4 5;
1 2 3 4 5;
1 2 3 ...
4ヶ月 前
解決済み
Swap between rows
The idea is to swap between second and second last row
Ex = [1 2 3 4 5;
5 4 3 2 1;
1 2 3 4 5;
1 2 3 4 5;
...
4ヶ月 前
解決済み
Matrix with different incremental runs
Given a vector of positive integers
a = [ 3 2 4 ];
create the matrix where the *i* th column contains the vector *1:a(i)...
4ヶ月 前
解決済み
surrounded matrix
With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones:
A = [1 2 ...
4ヶ月 前
解決済み
Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal.
Example:
>> M=magic(5);
>> flipDiagonal(M)
9 24 1 ...
Back to basics 23 - Triangular matrix
Covering some basic topics I haven't seen elsewhere on Cody.
Given an input matrix, return a matrix with all elements above a...
4ヶ月 前
解決済み
Back to basics 21 - Matrix replicating
Covering some basic topics I haven't seen elsewhere on Cody.
Given an input matrix, generate an output matrix that consists o...
4ヶ月 前
解決済み
Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN;
output -> matrix(p*m), the same matrix where we deleted the enti...
4ヶ月 前
解決済み
"mirror" matrix
Create n x 2n "mirror" matrix of this type:
Examples
For n = 2
m = [ 1 2 2 1
1 2 2 1 ]
For n = 3
m = ...
Find Rows with Specift Properities
Delete rows with specific properites as following:
Find rows that have a negative value in any element of the row and delete it...