get new column using existing columns

3 vues (au cours des 30 derniers jours)
Amila
Amila le 22 Juil 2022
Commenté : Amila le 22 Juil 2022
I have to do two things
  1. I have a 13 colums and from that i need to compute value and make new column i have tried to do it like this but it give only zerows for each raw
  2. i need to save the file with the new column as 14 column data sheet
note: data set has about 1milion raws and 13 columns
the data is in a out put name Result2
Result2 = [D1, D2, D3, D4, D12, Ex, Az, Am, Te, IRR1, IRR2, IRR3, IRR4];
new colum i need is rat1
rat1 = (Result2(:,12). *2)/((Result2(:,11) + Result2(:,13))/2)
final output should be like below
Result3 = [D1, D2, D3, D4, D12, Ex, Az, Am, Te, IRR1, IRR2, IRR3, IRR4, rat1];
note since data file is two large this massage comes it asked to use matlab v7.3 or above please tel me the way i can generate the above Result3 file thank you verry mutch
  2 commentaires
Dyuman Joshi
Dyuman Joshi le 22 Juil 2022
Modifié(e) : Dyuman Joshi le 22 Juil 2022
Dot is missing for element wise division.
Also, since the data is quite large, directly append the data as the last column, rather than storing it.
Result2 = [D1, D2, D3, D4, D12, Ex, Az, Am, Te, IRR1, IRR2, IRR3, IRR4];
Result2 = [Result2 2*Result2(:,12)./(Result2(:,11) + Result2(:,13))/2];
%or
Result2(:,14)=2*Result2(:,12)./(Result2(:,11) + Result2(:,13))/2;
I think the latter would be faster.
Amila
Amila le 22 Juil 2022
Thank you very very mutch its working

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Code Generation dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by