Nested structure error with definition . please help.
Show older comments
function [ struct_data ] = Initialize_Data_Structure( no_turbines, no_towers )
% Initialize_Data_Structure initialises the data structure and fills with dummy data
for ii=1:no_turbines
struct_data.Turbine(ii,1).Name='';
struct_data.Turbine(ii,1).Gear_Ratio=0;
struct_data.Turbine(ii,1).Rotor.Speed=zeros(2,1);
struct_data.Turbine(ii,1).Rotor.Mode_Names=cell(2,1)';
struct_data.Turbine(ii,1).EF_Names={'EF1','EF2'};
struct_data.Turbine(ii,1).EF_Wind_Speed=zeros(2,1);
struct_data.Turbine(ii,1).EF_Rotor_Speed=zeros(2,1);
for jj=1:no_towers
struct_data.Turbine(ii,1).Tower(jj,1).Name= num2str(jj,'Tower %d');
struct_data.Turbine(ii,1).Tower(jj,1).EF_Data= zeros(2,2);
end
end
end
I am getting an error " Undefined function or variable 'no_turbines'." I am trying to create a nested structure. is there something wrong with the approach.
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!