Hello,
i have the following two tables:
Tab1=table('Size',[9 3],'VariableTypes',{'cell','double','double'},'VariableNames',{'Description','Year','Value'});Tab1.Description(:)={'Gas','Gas','Gas','Pellets','Pellets','Pellets','Oil','Oil','Oil'};Tab1.Year(:)=[2015,2020,2025,2015,2020,2025,2015,2020,2025];Tab2=table('Size',[6 3],'VariableTypes',{'cell','double','double'},'VariableNames',{'Description','Year','Value'});Tab2.Description(:)={'Wood','Wood','Wood','FW','FW','FW'};Tab2.Year(:)=[2015,2020,2025,2015,2020,2025];Tab2.Value(:)=[5,10,17,7,25,75];
I try the following calculation:
Tab1(strcmp(Tab1.Description,or('Gas','Oil')),'Value')=Tab2(strcmp(Tab2.Description,'FW'),'Value');
The or-part seems to be the problem. I want the Value of 'FW' from Tab2 as the Value of 'Gas' and 'Oil' in Tab1. My original table is way bigger, so seperate calculations like:
Tab1(strcmp(Tab1.Description,'Gas'),'Value')=Tab2(strcmp(Tab2.Description,'FW'),'Value');Tab1(strcmp(Tab1.Description,'Oil'),'Value')=Tab2(strcmp(Tab2.Description,'FW'),'Value');
are not purposeful. Maybe an if-condition with
||
could help, but i dont know how.
I will greatly appreciate any assistance.
Best Answer