Assignment between unlike types is not allowed for two function in a loop
Show older comments
hi, I converted the variables, S, V and D into struct, because I am using two criteria to evaluate, in the end the variable name is the same and I have to do a sum of those values, what should change (in Matlab I have the following error: Assignment between unlike types is not allowed) Is it possible to save them like this? or better I change the name of the variable as S1, S2 etc and at the end in my equation I add one by one.
For the first loop is working but after it finishes
%% Cracks
for i = 1:5
load([DataFolder '\' sprintf('beam_crack_%d.mat',i)]);
[S(i,:),V(i,:),D(i,:), n(i,:), Zi(i,:)] = bc_DE(beam_crack);
end
%% Spalling
for i = 1:5
load([DataFolder '\' sprintf('beam_spalling_%d.mat',i)]);
[S(i,:), V(i,:), D(i,:), n(i,:)] = bs_DE(beam_spalling);
end
In the function, one variable look like this
S.S1 = input('Input damage structural stability rate (S) (0-4) :');
while S.S1 <0 || S.S1 > 4
disp('Not a valid number please try again')
S.S1 = input('Enter a whole number between 0 and 4:');
end
Accepted Answer
More Answers (0)
Categories
Find more on Structures 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!