필터 지우기
필터 지우기

Summing Matrices after textscan/ formatspec issue?

조회 수: 1 (최근 30일)
Philip Hoskinson
Philip Hoskinson 2016년 3월 18일
댓글: Philip Hoskinson 2016년 3월 18일
I imported data with textscan because of multiple delimiters: it creates matrices of:
[20x20 int64] [20x20 int64] [20x20 int64]
[20x20 int64] [20x20 int64] [20x20 int64]
[20x20 int64] [20x20 int64] [20x20 int64]
I just guessed the formatspec, the data are numbers:
[[ 60.43 , 2349.33] , [..]] etc
Now I need to add the matrices and I get this error:
Error using +
Integers can only be combined with integers of the same
class, or scalar doubles.
How do I pick the proper formatspec/ make them scalar doubles?

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 18일
You should be using %f format for reading numbers with decimal points.
  댓글 수: 1
Philip Hoskinson
Philip Hoskinson 2016년 3월 18일
I used %n and it worked, i guess they are both for doubles.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by