Code covered by the BSD License  

Highlights from
struct2ws

4.0

4.0 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 1.66 KB File ID: #14068

struct2ws

by Maximilien Chaumon

 

23 Feb 2007 (Updated 23 Feb 2007)

Throws selected fields of a scalar structure in the current workspace.

| Watch this File

File Information
Description

% struct2ws(s,varargin)
%
% Description : This function returns fields of scalar structure s in the
% current workspace
% __________________________________
% Inputs :
% s (scalar structure array) : a structure that you want to throw in
% your current workspace.
% re (string optional) : a regular expression. Only fields
% matching re will be returned
% Outputs :
% No output : variables are thrown directly in the caller workspace.
%
% Examples :
%
% Example 1:
% >> who
%
% Your variables are:
%
% params
%
% >>struct2ws(params)
% >> who
%
% Your variables are:
%
% blanc grille ratio_ecran unitX
% c_map gris rect unitY
% centre magni_jitt taille window
% dim_grille noir taille_cr zoomzoom
% epais_cr params taille_items
%
% Example 2:
% >> struct2ws(params,'unit')
% >> who
%
% Your variables are:
%
% params unitX unitY
%
%
% _____________________________________
% See also : ws2struct ; regexp
%
% Maximilien Chaumon v1.0 02/2007

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
25 Feb 2007 urs (us) schwarz

the engine can be simplified:

vm=regexp(vars,re,'match');
vm=[vm{:}];
for i=vm
disp(sprintf('token %s',i{1}));
% use your assignin with i{1}...
end

us

01 Apr 2007 mz htut  
08 Jan 2009 Stefan Spielauer  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
structures Maximilien Chaumon 22 Oct 2008 09:01:44
cell arrays Maximilien Chaumon 22 Oct 2008 09:01:44
workspace Maximilien Chaumon 22 Oct 2008 09:01:44
utilities Maximilien Chaumon 22 Oct 2008 09:01:45

Contact us at files@mathworks.com