Need help changing a function to delete columns instead of rows

조회 수: 2 (최근 30일)
Darius Karneckij
Darius Karneckij 2021년 7월 12일
답변: Jayant Gangwar 2021년 7월 13일
I found a function online that can import data into google sheets and it has a way to delete rows in the file but not columns. I looked through and unable to identify what part of the function is even responsible for deleting rows, so I haven't been able to figure out how to make it delete columns. I know its a bit of work, but if anyone is able to look at it and figure it out, that'd be very helpful!
This is the function
  댓글 수: 2
dpb
dpb 2021년 7월 12일
Just transpose the input array.
dpb
dpb 2021년 7월 13일
"what part of the function is even responsible for deleting rows, "
That certainly doesn't seem to be hard to track down...
% check if this is a delete row operation
if isempty(d)
...
status = deleteRows(spreadsheetID, sheetID, sheetpos, aSheets);
...
The deleteRows function is internal function within the whole mess of all the code that is all strung together in one file.

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

답변 (1개)

Jayant Gangwar
Jayant Gangwar 2021년 7월 13일
It seems to me you are trying to find a way to delete columns while importing data into google sheets.
The function mat2sheets(spreadsheetID,sheetID,pos,d) has 4 input arguments where the first two are the identifiers of the respective sheets where as the 3rd argument specifies which cell do you want to start writing your data d. Now if you will give an empty array d as an input then this function will automatically delete the rows given in pos, for examples if pos=[2 10] , d=[] , then rows 2-10 will be deleted.
To delete column you can transpose your input data and use the above method to delete the rows.

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by