Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How can I edit this code ?

1 vue (au cours des 30 derniers jours)
ND
ND le 30 Nov 2015
Clôturé : MATLAB Answer Bot le 20 Août 2021
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

Réponses (1)

Image Analyst
Image Analyst le 30 Nov 2015
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