cell2vars: Transform cell to vars

cell2vars: Transform cell's columns' to variables in workplace
334 Downloads
Updated 8 Oct 2012

View License

% PURPOSE: Convert the cell's columns' to variables in matlab workspace
% -----------------------------------------------------------------------------
% SYNTAX:
% (1) cell2vars(cellvar)
% (2) cell2vars(cellvar, newvarname)
% -----------------------------------------------------------------------------
% OUTPUT:
% (1) each column of the cell is been transform to a variable in matlab
% workspace
% -----------------------------------------------------------------------
% INPUT:
% (1) cellvar: NxM --->a cell containing M columns. Each column include
% a head and its body.
% (2) newvarname: 1xM ---> M string as new head for the column.
% NB: no string can be include in the file.

% -----------------------------------------------------------------------
% LIBRARY:
% -----------------------------------------------------------------------
% SEE ALSO: vars2cell,
% -----------------------------------------------------------------------
% REFERENCE: assigni, eval
% -----------------------------------------------------------------------
% written by:
% Lin Renwen
% <linrenwen@gmail.com>

% Version 1.0 [2012-6-27 20:29:25]

%=============================================
% EXAMPLE:
% INPUT:
% > A = {'name','grade'; 1,56; 2,78; NaN,90};
% > cell2vars(A);
% > name
% name =
% 1
% 2
% NaN
%
% > grade
% grade =
% 56
% 78
% 90
% % END OF EXAMPLE
%=============================================

Cite As

Renwen Lin (2024). cell2vars: Transform cell to vars (https://www.mathworks.com/matlabcentral/fileexchange/37290-cell2vars-transform-cell-to-vars), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Structures in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.2.0.0

Revise the example; thanks so much! Simon

1.1.0.0

Adjust according to Jan Simon's suggestion. Jan thanks so much!

1.0.0.0