爲簡單起見,讓我們堅持使用this official Matlab example。在Matlab中清空結構數組的所有字段
我運行下面的代碼,並創建一個有三個字段的結構。
patient.name = 'John Doe';
patient.billing = 127.00;
patient.test = [79, 75, 73; 180, 178, 177.5; 220, 210, 205];
然後,爲了創建一個結構數組,我只需要執行以下操作。
patient(2).name = 'Ann Lane';
patient(2).billing = 28.50;
patient(2).test = [68, 70, 68; 118, 118, 119; 172, 170, 169];
在這一點上我有,這顯然是this picture代表的結構數組:
問題來了:我怎樣才能清空結構patient(2)
的所有領域?
理想情況下(原諒濫用符號)我想要做一些像patient(2).* = {}
。
調用字段是不是一個選項,因爲在我的實際代碼中,我有很多字段,我也不能將結構轉換爲單元格。
提前致謝!
@Ander Biguri謝謝你這麼多的圖像添加到這個問題,我沒有在我貼:) – lucam