Code covered by the BSD License  

Highlights from
Optimization of a Double Wishbone Suspension System

image thumbnail

Optimization of a Double Wishbone Suspension System

by

 

31 Oct 2006 (Updated )

Demo files from the Webinar "Introduction to Optimization with MATLAB(R) Products" Oct. 26, 2006

importfile(fileToRead1,varargin)
function importfile(fileToRead1,varargin)
%IMPORTFILE(FILETOREAD1)
%  Imports data from the specified file
%  FILETOREAD1:  file to read
%  other use: 
%     importfile(fileToRead1,'caller') --> assign to current workspace

%  Auto-generated by MATLAB on 19-Oct-2006 14:59:46

if nargin > 1
    wrkspc = varargin{1};
else
    wrkspc = 'base';
end

% Import the file
newData1 = importdata(fileToRead1);

% For some XLS and other spreadsheet files, returned data are packed
% within an extra layer of structures.  Unpack them.
fields = fieldnames(newData1.data);
newData1.data = newData1.data.(fields{1});
fields = fieldnames(newData1.textdata);
newData1.textdata = newData1.textdata.(fields{1});
fields = fieldnames(newData1.colheaders);
newData1.colheaders = newData1.colheaders.(fields{1});

% Break the data up into a new structure with one field per column.
colheaders = genvarname(newData1.colheaders);
for i = 1:length(colheaders)
    dataByColumn1.(colheaders{i}) = newData1.data(:, i);
end

% Create new variables in the base workspace from those fields.
vars = fieldnames(dataByColumn1);
for i = 1:length(vars)
    assignin(wrkspc, vars{i}, dataByColumn1.(vars{i}));
end

Contact us