Reading data with Strcat and alternative

1 view (last 30 days)
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!

Accepted Answer

Walter Roberson
Walter Roberson on 25 Apr 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.

More Answers (0)

Categories

Find more on Characters and Strings 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!