Skip to content

Gureum-and-Yeoreum/parstruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

parstruct

Returns for loop data within parfor loop to a structure.

[structed] = parstruct(structed,nvars,varname,n,varargin)


Input variables

structed: name of the structure
nvars: number of input variables
varname: fieldnames of the structure
n: for loop index (use n = 1 to save noniterative data or to define fieldname for the first time and save data. n must be an positive integer)
varargin: data to be structed, Variable-length input argument


Output variable

structed: structed data of each parfor loop


Caution

nvars and the size of varargin, and varname must be the same
n IS NOT the index of parfor loop
must define fieldname before save date (read description of input variable n)


How to use & Example

image


parfor loop condition: initVal = 1, endVal = 3
for loop condition: n_end = 5

the result struct is

image

Field1 and Field2 is iterative data of 17 * 17 matrix with 5 for loop iterations. hence it becomes 17 * 17 * 5 matrix
Noniter1 and Noniter2 is noniterative data

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages