Initialize & Substitute to Matrix (C.Basic)

 Initialize & Substitute to Array
<C.Basic>

This content is checked by fx-9860GII (OS 2.04).
This is on-going project, any changes may be made.


Model

fx-9860G Series


Syntax

Compatible
1. Fill(<number>)

Compatible + Extended (see Note below)
2. [[<E11>,<E12>, ...][<E21>,<E22>, ...] ... ]→Mat A  (Allocates & Initializes Matrix)

Extended
3. [["<string 1>"]["<sring 2>"] ... ]→Mat A    (Allocates & Initializes Matrix)
4. <nunber>→Mat A



Key Press

Mat        [SHIFT][2] 


Function
  1. Initializes a matrix by filling all elements with Fill(<number>).
  2. Initializes a matrix by setting every elements <Eij>.
  3. Initializes a matrix by setting strings <string n>
  4. Initializes a matrix by filling all elements with <number>, it's same as Fill comamnd.

Description
  1. User must allocate memory for a matrix before initialize and use it.
  2. It's recommended that user release the allocated memory for matrix before end of program. Otherwise the allocated memory reamains until the same matrix is allocated or initiaized again.
  3. <Eij> means an element at row i and column j (see Example 1).
  4. User can use strings <string n> to allocate and initialize a matrix (see Example 2 & 3).

Note

Example 1

C.Basic allows user to use carriage return and space within [ ]. Allocating and initializing a matrix in the following way is good for easy-to-read sorece code;

    [
      [0x1234,0x2345,0x3456]
      [0x4567,0x5678,0x6789]
      [0x789A,0x89AB,0x9ABC]
    ]Mat A


User can explicitly write a constant in hexadecimal or binary expression by adding prefix "0x"/"0X" or "0b"/"0B" subsequently. 


Example 2

Extended usage of matrix helps strings operation, see following sample;

    [
      "1:ABC",
      "2:DEF",
      "3:GHI"
    ]→>Mat S
    Locate 1,2,&Mat S[1]
    Locate 1,3,&Mat S[2]
    Locate 1,4,&S[3]
    Locate 1,5,&S[1,3]
    Clrmat

This code dislays as follows;

    1:ABC
    2:DEF
    3:GHI
    ABC


This way is similar to string handing of C language. Instead of & user can use $.
User can write S[ ] instead of Mat S[ ]


Example 3

    [
      "ABCD",
      "EFGH"
    ]→Mat B
    Locate 1,1,B[1,1]:Locate 4,1,B[1,2]
    Locate 7,1,B[1,3]:Locate 10,1,B[1,4]:Locate 13,1,B[1,5]
    Locate 1,2,B[2,1]:Locate 4,2,B[2,2]
    Locate 7,2,B[2,3]:Locate 10,2,B[2,4]:Locate 13,2,B[2,5]
    
This code displays as follows;

    65 66 67 68 0
    69 70 71 72 0

Each element is a charactor code of each alphabet. When allocate the matrix in this way using strings, the matrix is 2 rows x 5 columns, not 2 rows x 4 column. each row corresponds to each string and 0 (zero) is automatically added in the last column. 




See also: Initialize Matrix, <number>->Mat A, <string>->Mat A, '#Str

Copyright (C) 2013 - 2016 Krtyski / egadget.blog.fc2.com  All Rights Reserved.



関連記事

テーマ : プログラム関数電卓
ジャンル : コンピュータ

コメントの投稿

非公開コメント

最新記事
最新コメント
カテゴリ
C# (3)
検索フォーム
Visitors
Online Counter
現在の閲覧者数:
プロフィール

やす (Krtyski)

Author:やす (Krtyski)
since Oct 30, 2013


プログラム電卓は、プログラムを作って、使ってナンボ!

実際に触って気づいたこと、自作プログラム、電卓プログラミングについて書いています

おもしろい・役に立つならクリックしてください。励みになります。
にほんブログ村 IT技術ブログ 開発言語へ
にほんブログ村


人気ブログランキングへ


FC2ブログランキングへ


写真: 「4駆で泥んこ遊び@オックスフォード郊外」

リンク
月別アーカイブ
Sitemap

全ての記事を表示する

RSSリンクの表示
最新トラックバック
ブロとも申請フォーム

この人とブロともになる

QRコード
QR