Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.0 - 日本語

Scilab 5.5.0
Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Scilabヘルプ >> API Scilab > Low level functions > 論理値の書き込み (Scilabゲートウェイ)

論理値の書き込み (Scilabゲートウェイ)

論理値の行列を書き込む方法.

呼び出し手順

入力引数プロファイル:

SciErr createMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, const int* _piBool)

名前指定変数プロファイル:

SciErr createNamedMatrixOfBoolean(void* _pvCtx, const char* _pstName, int _iRows, int _iCols, const int* _piBool)

引数

_pvCtx

Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.

_iVar

変数を配置するScilabメモリの位置.

_pstName

"名前指定"関数の変数名.

_piRows

返される変数の行数.

_piCols

返される変数の列数.

_piBool

返されるデータ配列のアドレス (大きさ: _iRows * _iCols).

SciErr

エラー構造体で, エラーメッセージ履歴と最初のエラー番号を 格納します.

Scilabメモリに直接書き込む.

呼び出し手順

入力引数プロファイル:

SciErr allocMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, int** _piBool)

引数

_pvCtx

Scilab環境ポインタ, api_scilab.h により定義された "pvApiCtx"で指定.

_iVar

変数を書き込むScilabメモリの位置.

_iRows

新規変数の行数.

_iCols

新規変数の列数.

_piBool

返される実数データ配列のアドレス (大きさ: _iCols * _iRows).

SciErr

エラー構造体で, エラーメッセージ履歴と最初のエラー番号を 格納します.

説明

このヘルプは論理値の行列を書き込む方法を説明します

ゲートウェイのソース

#include "api_scilab.h"

int read_write_boolean(char *fname,unsigned long fname_len)
{
    SciErr sciErr;
    int i;
    // 最初の変数の情報 : doubleの実数行列
    int iRows       = 0;
    int iCols       = 0;
    int *piAddr     = NULL;
    int* piBool     = NULL;

    // 入力/出力引数を確認
    CheckInputArgument(pvApiCtx, 1,1);
    CheckOutputArgument(pvApiCtx, 1,1);

    // 最初の入力引数の変数アドレスを取得
    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
    if(sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    // Scilabメモリから大きさとデータを取得
    sciErr = getMatrixOfBoolean(pvApiCtx, piAddr, &iRows, &iCols, &piBool);
    if(sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    // データ処理を行う
    for(i = 0 ; i < iRows * iCols ; i++)
    {
        piBool[i] = piBool[i] == 0 ? 1 : 0;
    }

    sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool);
    if(sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
    return 0;
}

Scilab テストスクリプト

a = [%t, %f, %t ; %f, %t, %f ; %t, %f, %t];
a_ref = [%f, %t, %f ; %t, %f, %t ; %f, %t, %f];
b = read_write_boolean(a);

if or(b <> a_ref) then error("failed"), end
Report an issue
<< 論理値の読み込み (Scilabゲートウェイ) Low level functions 論理値疎行列の読み込み (Scilabゲートウェイ) >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Fri Apr 11 14:19:08 CEST 2014