Filter löschen
Filter löschen

calculation in csv through matlab

2 Ansichten (letzte 30 Tage)
SINDU GOKULAPATI
SINDU GOKULAPATI am 21 Mär. 2021
Bearbeitet: Cris LaPierre am 22 Mär. 2021
we know like xcell operations can be performed in csv like multipling 2 rows etc
eg) when we append data to csv from a matrix , we get a row of data
suppose i want that data*2 but not perform that calculation in matlab and do it in csv (=A1*2 %this type)
and then read the next coloumn (B) to get the result
how do i proceed?
thaks for any help you can provide
  4 Kommentare
SINDU GOKULAPATI
SINDU GOKULAPATI am 22 Mär. 2021
same as xcell files csv files do perform cell operations , its not limited
i have tried performing cell operation in csv and read the result in matlab so in that sence i know it is possible
Cris LaPierre
Cris LaPierre am 22 Mär. 2021
Sure you can add them. You just can't save the equations in a csv file. If you save as a csv file, the equations are replaced with values. Close and reopen the csv file, and you'll see that the updated values are still there, but all the equations are gone.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Cris LaPierre
Cris LaPierre am 22 Mär. 2021
Bearbeitet: Cris LaPierre am 22 Mär. 2021
You may find the following two posts helpful.
The resulting code would be something like this.
file = 'D:\Applications\work\example.csv'; % This must be full path name
% Create connection to Excel
excelapp = actxserver('Excel.Application');
wkbk = excelapp.Workbooks.Open(file);
% Write equation to specified cell:
EqnRange = wkbk.Activesheet.get('Range','B1');
EqnRange.Formula = '=A1*2';
% Save changes. This leaves the value in the csv file, not the equation
invoke(wkbk,'Save');
% Close Excel and clean up
invoke(excelapp,'Quit');
delete(excelapp);
clear excelapp;

Kategorien

Mehr zu Standard File Formats finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by