load2var

Load a specific variable from a mat file and returns it.
2.1K Downloads
Updated 18 Nov 2004

No License

LOAD2VAR loads a specific variable
from a mat file and returns it.
If no variable name is provided,
the first variable is chosen.

Made as an example for "loading mat-files!"

USAGE:
>> a=magic(3);
>> b='not me';
>> save('tmp');
>> clear all;
>> c=load2var('tmp','a')

c = 8 1 6
3 5 7
4 9 2

>> c=load2var('tmp','b')

c = not me

>> c=load2var('tmp')

c = 8 1 6
3 5 7
4 9 2

>> c=load2var('tmp','d')

c = []

IT'S NOT FANCY BUT IT WORKS

Cite As

Michael Robbins (2024). load2var (https://www.mathworks.com/matlabcentral/fileexchange/6303-load2var), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Import and Analysis 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.0.0.0