How to multiply a matrix by 0?
이전 댓글 표시
Hello,
I have this file in .txt and i want to make a matrix and multiply it by 0 using matlab!
Can somebody help me? I've been looking at other videos and answers but can't work it out. Thanks!
답변 (1개)
Why to muply the matrix by zero when the resul;t will be a matrix of the same size with zeros. If you need to create a matriz of the same size as your data, then this is the way:
clearvars
unzip('HSF_PVerde_Lvl1.zip');
D = readmatrix('HSF_PVerde_Lvl1.txt');
D0 = zeros(size(D)); % This is the way
D0A = D*0;
whos
D0
D0A
댓글 수: 1
Why to muply the matrix by zero when the resul;t will be a matrix of the same size with zeros.
Most of the time that's correct. If nonfinite values are involved it's not.
A = [1 2 0; NaN Inf -Inf]
B = 0*A
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!