fprintf replace values from xlsread table
Show older comments
I have a column of 100 zeroes and in certain positions in the column I want them to be replaced with a value. The position and replacement values are held inside the trial.xlsx file. What could I use to do this. Previously I was using b(positionvalue)=replacementvalue but now there are too many position values to just type them in.
b=zeros(100,1);
a = xlsread('trial.xlsx','Sheet1','A2:B1473');
c = 9 * ones(length(b),1);
c(b==0) = 1;
d=[c,b];
fileID = fopen('xlsreadtrial.txt','w');
fprintf(fileID,'%.*f\n',d');
fclose(fileID);
5 Comments
Paolo
on 12 Jun 2018
Could you attach 'trial.xlsx' file?
Anna Cole
on 12 Jun 2018
Paolo
on 12 Jun 2018
I have a column of 100 zeroes
How can you fit 1476 lines in a column of 100 zeros?
Anna Cole
on 12 Jun 2018
Walter Roberson
on 12 Jun 2018
How would position 101927062 be converted into an index into b ?
Accepted Answer
More Answers (0)
Categories
Find more on Multidimensional Arrays 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!