get new column using existing columns
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
I have to do two things 
- 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
- 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 comentarios
  Dyuman Joshi
      
      
 el 22 de Jul. de 2022
				
      Editada: Dyuman Joshi
      
      
 el 22 de Jul. de 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.
Respuestas (0)
Ver también
Categorías
				Más información sobre Whos en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

