필터 지우기
필터 지우기

How to set Excel cell color to from Matlab using R1C1 range notation?

조회 수: 14 (최근 30일)
Don Kalinich
Don Kalinich 2020년 1월 29일
편집: Don Kalinich 2020년 1월 29일
This question is related to this one:
https://www.mathworks.com/matlabcentral/answers/3352-how-to-set-excel-cell-color-to-red-from-matlab
And the question is, can the Range be specifed in R1C1 notation rather than A1 notation? And if so, how?
WB.Worksheets.Item(1).Range('A1').Interior.ColorIndex = 3;
I have tried the following with no success:
WB.Worksheets.Item(1).Range(cells(i+1,j+1),cells(i+1,j+1)).Interior.ColorIndex = str2double(outTblColor{i,j});
Thanks for the help.
  댓글 수: 2
Allen
Allen 2020년 1월 29일
As alternative to trying to work with R1C1 notation (never was successful using this via ActiveX), you could use the xlscol function (FileExchange) to convert R1C1 input to the standard A1 notation.
The following code segment shows one way of converting your i and j variables to row and columns text, respectively.
A1notation = sprintf('%s%s',xlscol(j),i+48); % Adding 48 to i corrects for ASCII values of numeric characters.
Don Kalinich
Don Kalinich 2020년 1월 29일
Thanks! Writing something like xlscol was going to be my next step. I implemented Mr. Crosby's xlscol and it works like charm.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by