Code covered by the BSD License  

Highlights from
fRMField

Be the first to rate this file! 4 Downloads (last 30 days) File Size: 7.27 KB File ID: #28517
image thumbnail

fRMField

by Jan Simon

 

20 Aug 2010

Remove a field from a struct efficiently - fast C-Mex

| Watch this File

File Information
Description

fRMField: Remove field(s) from a struct - fast C-MEX
This function is about 5 to 10 times faster than RMFIELD of Matlab 2009a.

T = fRMField(S, Name)
INPUT:
  S: Struct or struct array.
  Name: String or cell string. Removing a name, which is not a field name
        of S, is *not* an error here, in opposite to Matlab's RMFIELD.
OUTPUT:
  T: Struct S without the removed fields.

EXAMPLES:
  S.A = 1; S.B = 2;
  T = fRMField(S, {'B', 'C'}); % >> T.A = 1
  T = fRMField(S, 'A'); % >> T.B = 2

TEST: Run TestfRMField to check validity and speed of the Mex function. See screenshot.

Tested: Matlab 6.5/2009a, WinXP 32bit, LCC2.4/3.8, BCC5.5, OpenWatcom1.8, MSVC2008
Compatibility to Linux, MacOS, 64bit, 2010a is assumed.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
cmex, delete, fast, field, remove, struct
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.

Contact us