Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Error Showing in my code... Please correct it It is showing matrix dimension must agree in s2

1 visualización (últimos 30 días)
clc;
clear all;
close all;
fileID= fopen('reciever_output');
a= fread(fileID);
lastn=3;
tst = a(1:end-lastn,:);
b= length(tst);
c1=[172];
d1= de2bi(c1);
c2= [90];
d2= de2bi(c2);
d=strcat(d1,d2);
rep=floor(b/15);
s1= repmat(d,rep,1);
s2=s1-tst;
num_ele=numel(s2)
nonzero= nnz(s2)
err_c=nonzero/num_ele
  1 comentario
Rik
Rik el 4 de Feb. de 2020
  • You did not attach the necessary data
  • You aren't opening any figures, so there is no need for close all
  • There is no need for clear all, if you want to remove all variables for debugging, use clear or clearvars instead
  • There are no comments in your code, so we have no idea what it is attempting to do
  • You did not describe the inputs on the line that caused the error

Respuestas (1)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi el 7 de Feb. de 2020
Hello Pulkit,
According to your description, in the line,
s2=s1-tst;
The error you get is pretty clear - the matrices that you're trying to operate on are not of the same sizes. Retrace your steps back to find out the exact specifics. The matrices s1 and tst should be of the same size to be subtracted from each other. It would have been more useful had you shared the file that you're importing.
Hope this helps!

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by