How do I switch specific elements in an index?
조회 수: 35 (최근 30일)
이전 댓글 표시
I have a 3000x7000 2d matrix
a = randi(20,3000,7000)
and I am trying to switch elements of specific indices, but don't know how. I currently have a csv with a column of the original index and another one for the index I would like to switch it to, should I change it to a txt file? I was looking for other posts similar to what I am searching for on here but I couldn't find anything quite right. What are the best practices for that strategy? Would it be a look up table? If so is it better to use a txt file or excel file?
EX: smaller sample size
x = randi(20,20);
xlsx:
original swap output
(index:value): (index:value): (index:value):
1:1 11:11 1:11
2:2 12:12 2:12
3:3 13:13 3:13
4:4 14:14 4:14
(output column so you can understand expected result)
Input:
1 2 3 4 ... 11 12 13 14
1 1 2 3 4 11 12 13 14
2 5 6 7 8
3 3 2 4 5
4 6 7 8 16
5 11 10 12 7
Expected Ouput: (x denotes other value from a different index in xlsx)
1 2 3 4 ... 11 12 13 14
1 11 12 13 14 x x x x
2 1 10 12 8
3 3 2 4 5
4 6 7 8 16
5 11 10 12 7
Edit: I am trying to achieve this but on a larger scale so I can work with larger datasets
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!