Reading data with Strcat and alternative

1 visualización (últimos 30 días)
Francesco Milani
Francesco Milani el 25 de Abr. de 2020
Respondida: Walter Roberson el 25 de Abr. de 2020
variable = xlsread('data.xlsx','Sheet', strcat('B', i_cell, ':G', f_cell));
In the above example I undestand that I am reading a specific sheet of the excel file but I dont get what " strcat('B', i_cell, ':G', f_cell)); " actually does.
Is there another way of writing the above code in a more easy way, by using another function instead of strcat?
Thanks in advance!

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Abr. de 2020
range = sprintf('B%d:G%d', start_row, end_row); %where start_row and end_row are numeric
variable = xlsread('Data.xlsx', 'Sheet', range);
However it is confusing that you have something that looks like a range as a sheet name.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by