fprintf replace values from xlsread table
显示 更早的评论
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 个评论
Paolo
2018-6-12
Could you attach 'trial.xlsx' file?
Anna Cole
2018-6-12
Paolo
2018-6-12
I have a column of 100 zeroes
How can you fit 1476 lines in a column of 100 zeros?
Anna Cole
2018-6-12
Walter Roberson
2018-6-12
How would position 101927062 be converted into an index into b ?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Low-Level File I/O 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!