# Difficulties converting E-001

1 visualización (últimos 30 días)
Anne el 4 de Jul. de 2024
Respondida: Walter Roberson el 4 de Jul. de 2024
Hi,
I'm importing an excel file to Matlab where example 45E-001 is divided into two column so A[1,1]= 45 and B[1,1]=E-001. "A" comes in as a double and "B" as a cell and when I'm trting to use str2double I only get Nan in each row. I would like to be able to do C = A .* B and that C[1,1] = 4.5.
Thank you
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Stephen23 el 4 de Jul. de 2024
@Anne: please upload a sample data file by clicking the paperclip button.

Iniciar sesión para comentar.

### Respuestas (2)

Andreas Goser el 4 de Jul. de 2024
I am a big fan of giving interactive importing a try. Try the import tool. One of the best functionalities is you can generate a function from that so you can repeat this interactive importing. In your case, you will likely need a few lines of postprocessing you can simply add to the auto-generated function.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Walter Roberson el 4 de Jul. de 2024
Insert a leading '1' before each of the exponentials, and then multiply the pairs together.
format long g
T = table([45; 17], {'E-001'; 'E+002'});
result = T.Var1 .* str2double(insertBefore(T.Var2, 1, '1'))
result = 2x1
1.0e+00 * 4.5 1700
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Spreadsheets en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by