How can I determinate which is the last column of an excel file?

6 views (last 30 days)
First of all, thanks for reading this. Well, I have an excel file with n variables (columns) and I have to read them with matlab, then I have to select one of them and do operations with that variable. Finally, I have to write/save that new variable in the same file, next to the last column used in that excel spreadsheet.
I doubt if I should use xlswrite, but I have to specify the column and the row where I want to "write" my new variable. I hope I had been explicit with my question. Greetings.
PD. If you could write parts of a code to be more explicit, I'll be grateful.
  1 Comment
dpb on 25 Jun 2014
Unless there's a method thru interacting w/ Excel, not sure there is a way to answer the question. You can find out how many columns have something in them by
after xlsread but that doesn't account for leading blank columns altho looks like gets intermediary ones filled in w/ NaN .

Sign in to comment.

Answers (0)


Find more on Data Import from MATLAB 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!

Translated by