Replace specific string in structure

2 ビュー (過去 30 日間)
Ting-Yu Chueh
Ting-Yu Chueh 2019 年 8 月 3 日
コメント済み: Ting-Yu Chueh 2019 年 9 月 7 日
Hi everyone,
I wan to replace all varibel-'keypad1' with '1'. Can anyone help me? Thanks.
螢幕快照 2019-08-03 下午5.37.44.png

採用された回答

Rik
Rik 2019 年 8 月 3 日
This should do the trick:
%create part of your data structure as an example
EEG=struct;
EEG.event(1).type='11';EEG.event(1).latency=rand;
EEG.event(2).type='keypad1';EEG.event(2).latency=rand;
EEG.event(3).type='21';EEG.event(3).latency=rand;
EEG.event(4).type='31';EEG.event(4).latency=rand;
EEG.event(5).type='keypad1';EEG.event(5).latency=rand;
L=ismember({EEG.event.type},{'keypad1'});
[EEG.event(L).type]=deal('1');
  1 件のコメント
Ting-Yu Chueh
Ting-Yu Chueh 2019 年 9 月 7 日
Thanks. Really useful!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by