Info

此问题已关闭。 请重新打开它进行编辑或回答。

How can I edit this code ?

1 次查看(过去 30 天)
ND
ND 2015-11-30
关闭: MATLAB Answer Bot 2021-8-20
Please I have this code
% code
ex = dlmread( 'BB.txt' ) ; %output data
S11 = dlmread( 'AA.txt' ) ; % input data
buffer = [S11,ex] ;
[~, ca] = unique( buffer, 'rows' ) ;
buffer = buffer(sort(ca),:) ;
Mshuffled = buffer(randperm(size(buffer,1)),:);
x1Range= 'B';
xlswrite( 'first.xlsx', [{'S11'}; num2cell( Mshuffled(:,1) )], 'X',x1Range) ;
xlswrite( 'first.xlsx', [{'E11'}; num2cell( Mshuffled(:,2) )], 'Y' ) ;
I need to multiply the data in (ex.txt) by 10^4 . So all rows in E11 column will be multiplied by this factor. Is that possible?
Many thanks

回答(1 个)

Image Analyst
Image Analyst 2015-11-30
Yes, but first you need to call dlmread('ex.txt') which you have not done yet. You've only read in AA.txt and BB.txt.
exData = dlmread( 'ex.txt'); % Input data
Next, I don't know what the "E11" column is. Columns have only letters, not letters and numbers. Do you mean the column that cell E11 is in, which, of course, is column "E" (column 5)? If so then:
% Multiply column 5 by 10^4
exData(:, 5) = exData(:, 5) * 10000;

Community Treasure Hunt

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

Start Hunting!

Translated by