From 279e4d40f2fad9c3896697c5fc9a3e62bab9add7 Mon Sep 17 00:00:00 2001 From: Davis King Date: Fri, 12 Dec 2008 00:16:25 +0000 Subject: [PATCH] Added more stuff to the example. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402723 --- examples/matrix_ex.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/matrix_ex.cpp b/examples/matrix_ex.cpp index 6e5c54952..fc6845da8 100644 --- a/examples/matrix_ex.cpp +++ b/examples/matrix_ex.cpp @@ -176,6 +176,9 @@ int main() // MATLAB: A = B(1,:) A = rowm(B,0); + // MATLAB: A = B([1:2],:) + A = rowm(B,range(0,1)); + // MATLAB: A = B(:,1) A = colm(B,0); @@ -201,8 +204,6 @@ int main() B = 5; // or equivalently set_all_elements(B,5); - // or equivalently - set_subm(B,get_rect(B)) = 5; // MATLAB: B([1:2],[1,2]) = 7 @@ -214,6 +215,9 @@ int main() // MATLAB: B(:,1) = 4 set_colm(B,0) = 4; + // MATLAB: B(:,[1:2]) = 4 + set_colm(B,range(0,1)) = 4; + // MATLAB: B(:,1) = B(:,2) set_colm(B,0) = colm(B,1);