how can I define an excel woorksheet in Matlab that consider the location of cells with equal numeric value and change them into specific values that I want.
3 views (last 30 days)
Show older comments
how can I define an excel worksheet in Matlab that consider the location of cells with equal numeric values and change them into specific values that I want. in other word I want : Region 1 = locations of all cells with numerical values of A Region 2 = locations of all cells with numeric value of B And so on. and then change each region to specific values that I want. and repeat it and each time changing region s first value to specific values, as many times that I want . each region has so many cells therefor I cant define them cell by cells in matlab.
0 Comments
Accepted Answer
dpb
on 16 Mar 2014
It's so trivial in Matlab; just import the array; make the changes and rewrite (assuming you must use Excel at all; why can't you just use Matlab?)
data=xlsread('yourfile.xls');
data(data==A)=newA;
data(data==B)=newB;
xlswrite('yourfile.xls',data)
You may have the problem depending on the values addressed in the FAQ--
13 Comments
dpb
on 18 Mar 2014
I don't know about how you're doing the "Excel link to Matlab" specifically, but certainly you'll have to fix any issue of whether the value passed is the character representation (a string/character variable) or the value itself. That should be relatively simple to deal with.
The "firstflg" is a variable you set to know whether the index array needs to be updated or whether to use the previously computed one. It's a local variable to Matlab controlled by whoever is in charge of the overall process which you've yet to describe how this whole thing is structured.
More Answers (0)
See Also
Categories
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!