MATLAB command to replace 0 in Excel
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
AKSHAY PUJARI
am 26 Aug. 2020
Beantwortet: Alan Moses
am 31 Aug. 2020
I have a 27 x 68 matrix written in excel using MATLAB. The cells in excel with value 0 needs to be replaced with a blank for a selected range of "C16:AC83".
Can you please suggest a command to do this.
I am using----- Excel = actxserver('Excel.Application');
so far i have found the command --- Excel.Activesheet.Cells.Replace(65535,[ ],[ ],1);
What is the applicable syntax?
0 Kommentare
Akzeptierte Antwort
Alan Moses
am 31 Aug. 2020
Hi Akshay,
You can use the readcell function to read a range of values and use the cellfun command to replace the zeros with blanks. You can then use the writecell function to update the excel sheet. For example:
T = readcell('myTable.xls','Range','C16:AC83');
C = cellfun(@(x)x(logical(x)),T,'uni',false);
writecell(C,'myTable.xls','Range','C16:AC83');
Hope this helps!
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!