Counting values in a column
Show older comments
Hello,
I have 2 columns in Excel that I would need to calculate in Matlab. In the first column I have a formula: =IF(J2=1;IF(ISNUMBER(K1);K1+1;1);0) In the second column: =IF(AND(J2=1;J3<>1);K2;0) After column J, I have it calculated in matlab. Thank you very much for the advice.
I created column J in matlab with the command: T.Platoon=double(T.CasRozdiel<=4). I have added a matlab file in the attachment.

How it looks in excel.

4 Comments
Rik
on 23 Aug 2022
I think you need this structure in Matlab (with your array A and row n):
if A(n,1)==1 && A(n,+1,1)~=1
A(n,3)=A(n,2);
else
A(n,3)=0;
end
Is this what you mean?
Zuzana Pániková
on 23 Aug 2022
Edited: Walter Roberson
on 23 Aug 2022
Image Analyst
on 24 Aug 2022
I'm not sure what you want. Why not simply read your existing Excel workbook in to MATLAB with readtable? The computed values (the numbers), not the formulas, are what should be read in. And since you did the computations in Excel, then numbers should be right.
Zuzana Pániková
on 24 Aug 2022
Accepted Answer
More Answers (0)
Categories
Find more on Data Import from 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!