2d array and 1d array

조회 수: 11 (최근 30일)
David Jones
David Jones 2020년 10월 8일
댓글: Stephen23 2020년 10월 8일
Hi
I have an array which is 1 X 55 (Called TempStorage) which is updated each iteration of the loop I want to store this information form TempStorage into my 2 D array 3X55 (Called DecodeData) so the first iteration of the loop I want to store TempStorage into DecodeData(row One) and on the second loop store TempStorage into DecodeData(row Two) and on the third loop store TempStorage into DecodeData(row three) how do I declare TempStorage and DecodeData, and how do I send the data from TempStorage to DecodeData(x)
I dont have much experience with Matlab any help would be greatly appreciated
David

채택된 답변

Stephen23
Stephen23 2020년 10월 8일
편집: Stephen23 2020년 10월 8일
N = 3;
DecodeData = nan(N,55);
for k = 1:N
TempStorage = ... whatever defines your 1x55 vector
DecodeData(k,:) = TempStorage;
end
Very basic MATLAB concepts, like how to use loops and how to allocate data using indexing, are introduced here:
  댓글 수: 2
David Jones
David Jones 2020년 10월 8일
Hi Stephen
Thank you for your answer it worked great, perhaps you can help me with the second part of my question ?
The 55 bits relate to 4 data bits then a parity bit do you no how I can seperate them out in an array to be able to check the parity
Thank You
David
Stephen23
Stephen23 2020년 10월 8일
"The 55 bits relate to 4 data bits then a parity bit do you no how I can seperate them out in an array to be able to check the parity"
What class are the data: numeric, char, or something else?
It would be highly unusual (and misleading) to refer to numeric values as "bits", so I presume that you must have some kind of binary data, presumably as a character vector. If the fifth bit (i.e. fifth element of the character vector) represent parity, then you can refer to it using indexing, e.g.
TempStorage(5)
Without concrete examples of your data I have to rely on guessing, which is usually not very accurate.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by