Subtracting previous cell?
Ältere Kommentare anzeigen
I have a multidimensional variable SC (1x1x104) which is storage capacity for a region from 2004 to 2012. I want to subtract current cell values from previous values so I can get a whole new variable TSC. I tried using the for loop code below but it didn't give the desired result. I hope someone can help with this. Thanks!
for t=1:length(SC); TSC=SC-(SC(:,:,t)-1)./t; end
Antworten (1)
KSSV
am 18 Jul. 2018
TSC = cell(1,103) ;
for i = 1:103
TSC{i} = SC{1,1,i}-SC{1,1,i+1} ;
end
3 Kommentare
Dorcas Oluwabimpe Idowu
am 18 Jul. 2018
Bearbeitet: Dorcas Oluwabimpe Idowu
am 18 Jul. 2018
Stephen23
am 19 Jul. 2018
@Dorcas Oluwabimpe Idowu: your question clearly states that you have cells of a cell array, and so KSSV's answer gives you a solution for cell arrays. But apparently actually you don't have a cell array at all, probably you have a numeric array. Please show us the output of this command:
whos SC
Dorcas Oluwabimpe Idowu
am 19 Jul. 2018
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!