Question regarding NAN in my matrix

1 view (last 30 days)
Philipp Mueller
Philipp Mueller on 11 Apr 2017
My question "Why i have NAN and '' at wsectionstart and wsectionlinestyle? Can i delete NAN and '' from array?
Code:
r_inputdataSigmaX=[;];
r_inputdataSigmaY=[;];
r_inputdataTau=[;];
w_inputdataTau=[;];
w_inputdataSigmaY=[;];
w_inputdataSigmaX=[;];
cuttofflinesSigmaX=[;];
cuttofflinesSigmaY=[;];
cuttofflinesTau=[;];
r_inputdata_logic=zeros(1,3);
w_inputdata_logic=zeros(1,3);%[0;0;0]; %zeros(m,n)
inputdata_cuttofflines_logic=zeros(1,3);%[0;0;0];
default_value_z=1e8; %hier setze defaultmässig die z Komponente/Wert der Cutofflinien
row1=0;
row2=0;
row3=0;
index_counter=1;
t=0;
%Einlese Prozedere
wholecontent = fileread('MatlabExport_2.txt')
sections = regexp(wholecontent, '\*+([^*]+)\*+([^*]+)', 'tokens')
for section = sections
switch(strtrim(section{1}{1}))
case 'Plot Page Options and Settings'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
plotpageSettings = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Die Diagram Options gelten jeweils für rainflow und woehler
case 'Diagram Options SigmaX'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
diagramoptionsSigmaX = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
case 'Diagram Options SigmaY'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
diagramoptionsSigmaY = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
case 'Diagram Options Tau'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
diagramoptionsTau = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Woehler Lines SigmaX'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
w_diagramoptionsSigmaX = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
w_inputdata_logic(1,1) = 1;
case 'Woehler Lines SigmaY'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
w_diagramoptionsSigmaY = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
w_inputdata_logic(1,2) = 1;
case 'Woehler Lines Tau'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
w_diagramoptionsTau = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
w_inputdata_logic(1,3) = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Rainflow Options SigmaX'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
r_diagramoptionsSigmaX = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
case 'Rainflow Options SigmaY'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
r_diagramoptionsSigmaY = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
case 'Rainflow Options Tau'
keyvalues = regexp(section{1}{2}, '([^\n\r=]+)=([^\n\r=]+)', 'tokens')
r_diagramoptionsTau = cell2table(vertcat(keyvalues{:}), 'VariableNames', {'Key', 'Value'})
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Rainflow Cutofflines SigmaX'
cuttofflinesSigmaX = cell2mat(textscan(section{1}{2}, '%f%f', 'HeaderLines', 1))
inputdata_cuttofflines_logic(1,1) = 1;
case 'Rainflow Cutofflines SigmaY'
cuttofflinesSigmaY = cell2mat(textscan(section{1}{2}, '%f%f', 'HeaderLines', 1))
inputdata_cuttofflines_logic(1,2) = 1;
case 'Rainflow Cutofflines Tau'
cuttofflinesTau = cell2mat(textscan(section{1}{2}, '%f%f', 'HeaderLines', 1))
inputdata_cuttofflines_logic(1,3) = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'StressSpectrum Data SigmaX'
w_inputdataSigmaX = cell2mat(textscan(section{1}{2}, '%f%f', 'HeaderLines', 1))
case 'StressSpectrum Data SigmaY'
w_inputdataSigmaY = cell2mat(textscan(section{1}{2}, '%f%f', 'HeaderLines', 1))
case 'StressSpectrum Data Tau'
w_inputdataTau = cell2mat(textscan(section{1}{2}, '%f%f', 'HeaderLines', 1))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case 'Rainflow Data SigmaX'
r_inputdataSigmaX = cell2mat(textscan(section{1}{2}, '%f%f%f', 'HeaderLines', 1))
r_inputdata_logic(1,1) = 1;
case 'Rainflow Data SigmaY'
r_inputdataSigmaY = cell2mat(textscan(section{1}{2}, '%f%f%f', 'HeaderLines', 1))
r_inputdata_logic(1,2) = 1;
case 'Rainflow Data Tau'
r_inputdataTau = cell2mat(textscan(section{1}{2}, '%f%f%f', 'HeaderLines', 1))
r_inputdata_logic(1,3) = 1;
otherwise
warning('Unknown section ERROR: %s', section{1}{1})
end
end
wsectionstart = str2double(strsplit(w_diagramoptionsSigmaY.Value{strcmp(w_diagramoptionsSigmaY.Key, 'wsectionstart')}));
wsectionsend = str2double(strsplit(w_diagramoptionsSigmaY.Value{strcmp(w_diagramoptionsSigmaY.Key, 'wsectionsend')}));
wsectionstartstress = str2double(strsplit(w_diagramoptionsSigmaY.Value{strcmp(w_diagramoptionsSigmaY.Key, 'wsectionstartstress')}));
wsectionlinestyle = strsplit(w_diagramoptionsSigmaY.Value{strcmp(w_diagramoptionsSigmaY.Key, 'wsectionlinestyle')});
wsectionslope = str2double(strsplit(w_diagramoptionsSigmaY.Value{strcmp(w_diagramoptionsSigmaY.Key, 'wsectionslope')}));
[zeilen,elemente] = size(wsectionstart)
[zeilen2,elemente2] = size(wsectionsend)
[zeilen3,elemente3] = size(wsectionlinestyle)
[zeilen4,elemente4] = size(wsectionslope)
Input .txt:
*******************Woehler Lines SigmaX************
wsectionstart=10000 1000000 1000000
wsectionsend=1000000 1000000000 1000000000
wsectionlinestyle=continuous dashed continuous
wsectionstartstress=359.941333357816 143.295225788333 143.295225788333
wsectionslope=5 5 0

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!