Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
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
Rik
Rik 2020년 2월 4일
  • 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

답변 (1개)

Vinai Datta Thatiparthi
Vinai Datta Thatiparthi 2020년 2월 7일
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!

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by