Checking Matrix Elements

버전 1.0.0.0 (1.82 KB) 작성자: Miroslav Balda
Function check.m displays all elements of a general matrix fulfilling a given condition.
다운로드 수: 2K
업데이트 날짜: 2005/11/23

라이선스 보기

Function check.m may accelerate debugging of a program. The function displays columnwise elements of a real, complex or string matrix, say A, obeying a condition Cond. The output of every element A(p,q) fitting Cond consists of items <row number p> <column number q> <element value A(p,q)> in a required format.

Forms of calls:
~~~~~~~~~~~~~~~
check(A) % outputs all elements of matrix A
check(A,Cond) % outputs elements fulfilling Cond
check(A,Cond,form) % ditto in a required format
% A, a matrix of numerical elements to be checked
% Cond, a condition put on the matrix elements (string);
% default condition 'A==A' => output full matrix
% form, a format of element output; default format '%13.4e'

Examples:
~~~~~~~~~
k=(1:5).^2;
check(k,'k<10','%5i') % displays
% 1 1 1
% 1 2 4
% 1 3 9

check(k,'k>10')
% 1 4 1.6000e+001
% 1 5 2.5000e+001

Z = [1 i; -i 1];
check(Z)
% 1 1 1.0000e+000
% 2 1 0.0000e+000 -1.0000e+000*i
% 1 2 0.0000e+000 +1.0000e+000*i
% 2 2 1.0000e+000

s = 'This is a string';
check(s, 's==double(''i'')', ' %s')
% 1 3 i
% 1 6 i
% 1 14 i

인용 양식

Miroslav Balda (2026). Checking Matrix Elements (https://kr.mathworks.com/matlabcentral/fileexchange/9121-checking-matrix-elements), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R14
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Characters and Strings에 대해 자세히 알아보기
버전 게시됨 릴리스 정보
1.0.0.0