필터 지우기
필터 지우기

Resizing a Matrix in MATLAB?

조회 수: 23 (최근 30일)
Nisar Ahmed
Nisar Ahmed 2022년 11월 17일
댓글: Nisar Ahmed 2022년 11월 17일
Hi,
Q.1: I have a matrix A of size 106 1 100. and after A = squeeze(A), the size is 106 100. Suppose I want unsqueeze A again to get back its size 106 1 100. How can I unsqeeze it?
Q.2: I have a matrix B of size 100 97 and I want resize it as 100 106 by adding 9 columns in the start (each has constant number). how I can do it in MATLAB?

채택된 답변

Torsten
Torsten 2022년 11월 17일
%Q1
A = rand(106,1,100);
size(A)
ans = 1×3
106 1 100
A = squeeze(A);
size(A)
ans = 1×2
106 100
A = reshape(A,[106 1 100]);
size(A)
ans = 1×3
106 1 100
%Q2
A = rand(100,97);
start_A = rand(100,9);
A = [start_A,A];
size(A)
ans = 1×2
100 106
  댓글 수: 1
Nisar Ahmed
Nisar Ahmed 2022년 11월 17일
@Torsten In Q2, start_A = rand(100,9); how can I use a constant value in all 9 columns instead of rand? Suppose I want to fill first 9 columns with 2450 value.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by