필터 지우기
필터 지우기

how to solve this reshape error?

조회 수: 1 (최근 30일)
Rakesh Roshan
Rakesh Roshan 2022년 5월 18일
답변: Voss 2022년 5월 18일
reading the data
a=dlmread('S11.txt')
freq=a(:,1)
Sparameter=a(:,2)
Sparameter=reshape(Sparameter,1,21])
dlmwrite('output.csv',Sparameter,'-append')
like this i will be generating lot of text files
but i am getting reshaping error as no of elements changed so what changes i should make in my code so that how much ever no elements are present in text files i will be able to reshape and store it in excel sheet.
Sparameter=reshape(Sparameter,1,[]) %i want 1 row and multiple columns plz suggest if this s correct
2018a version

답변 (1개)

Voss
Voss 2022년 5월 18일
Yes, this converts Sparameter into a row vector:
Sparameter=reshape(Sparameter,1,[])
However, since Sparameter is a column vector beforehand, from here:
Sparameter=a(:,2)
You can merely transpose it at that time instead of using reshape:
Sparameter=a(:,2).'

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by