Why does the INSERT function generate an error when the character string I am trying to insert contains NULL characters in the Database Toolbox 3.0.1 (R14SP1)?

I am trying to use INSERT to insert a character string containing NULL (ASCII 0) characters. This causes INSERT to produce an error specific to the database I am using.

 採用された回答

The Database Toolbox's INSERT function cannot be used to insert character strings that include the NULL character (ASCII 0). As a workaround, the NULL characters can either be removed or set to space characters, as in the following examples:
% remove null characters from character array "insert_data"
idx = find(insert_data == 0);
insert_data(idx) = [];
% set the null characters in character array "insert_data" to space characters:
idx = find(insert_data == 0);
insert_data(idx) = ' ';

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

製品

リリース

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by