Shuffle matrix based on column elements

3 views (last 30 days)
EK
EK on 7 Oct 2023
Commented: Voss on 8 Oct 2023
Hi,
I have matrices like in the file attached below. The 4 columns log for stimuli representation in time. The rows are time and the columns are events. The first column logs stimuli id in time. (No stimulus =0, stimulus : 1 2 3 4 5 or 6) The second column logs the stimulus presentation time and its duration (0= No stimulus, 2=Stimulus); column 3 logs duration and ID of each trial. Trial 1 ==1; Trial trial 2 ==2; etc . I need to shuffle trials Ids (column3). Can anyone help with it?
  2 Comments
EK
EK on 7 Oct 2023
sorry, I forgot to attach. It is attached now

Sign in to comment.

Accepted Answer

Voss
Voss on 8 Oct 2023
Here's one way:
data = readmatrix('logfile_example-30-09-23.xlsx')
data = 1820×4
0 1 1 1 0 1 1 2 0 1 1 3 0 1 1 4 0 1 1 5 0 1 1 6 0 1 1 7 0 1 1 8 0 1 1 9 0 1 1 10
[trial_idx,trial_id] = findgroups(data(:,3));
n_trials = numel(trial_id);
order = randperm(n_trials)
order = 1×10
4 9 3 2 1 6 10 8 7 5
result = [];
for ii = 1:n_trials
result = [result; data(trial_idx == order(ii),:)];
end
disp(result);
0 1 4 547 0 1 4 548 0 1 4 549 0 1 4 550 0 1 4 551 0 1 4 552 0 1 4 553 0 1 4 554 0 1 4 555 0 1 4 556 0 1 4 557 0 1 4 558 0 1 4 559 0 1 4 560 0 1 4 561 0 1 4 562 0 1 4 563 0 1 4 564 0 1 4 565 0 1 4 566 0 1 4 567 0 1 4 568 0 1 4 569 0 1 4 570 0 1 4 571 0 1 4 572 0 1 4 573 0 1 4 574 0 1 4 575 0 1 4 576 0 1 4 577 0 1 4 578 0 1 4 579 0 1 4 580 0 1 4 581 0 1 4 582 0 1 4 583 0 1 4 584 0 1 4 585 0 1 4 586 0 1 4 587 0 1 4 588 0 1 4 589 0 1 4 590 0 1 4 591 0 1 4 592 0 1 4 593 0 1 4 594 0 1 4 595 0 1 4 596 0 1 4 597 0 1 4 598 0 1 4 599 0 1 4 600 0 1 4 601 0 1 4 602 0 1 4 603 0 1 4 604 0 1 4 605 0 1 4 606 0 1 4 607 0 1 4 608 0 1 4 609 0 1 4 610 0 1 4 611 0 1 4 612 0 1 4 613 0 1 4 614 0 1 4 615 0 1 4 616 2 2 4 617 2 2 4 618 2 2 4 619 2 2 4 620 2 2 4 621 2 2 4 622 2 2 4 623 2 2 4 624 2 2 4 625 2 2 4 626 2 2 4 627 2 2 4 628 2 2 4 629 2 2 4 630 2 2 4 631 2 2 4 632 2 2 4 633 2 2 4 634 2 2 4 635 2 2 4 636 2 2 4 637 2 2 4 638 2 2 4 639 2 2 4 640 2 2 4 641 2 2 4 642 2 2 4 643 2 2 4 644 2 2 4 645 2 2 4 646 2 2 4 647 2 2 4 648 2 2 4 649 2 2 4 650 2 2 4 651 2 2 4 652 2 2 4 653 2 2 4 654 2 2 4 655 2 2 4 656 2 2 4 657 2 2 4 658 0 3 4 659 0 3 4 660 0 3 4 661 0 3 4 662 0 3 4 663 0 3 4 664 0 3 4 665 0 3 4 666 0 3 4 667 0 3 4 668 0 3 4 669 0 3 4 670 0 3 4 671 0 3 4 672 0 3 4 673 0 3 4 674 0 3 4 675 0 3 4 676 0 3 4 677 0 3 4 678 0 3 4 679 0 3 4 680 0 3 4 681 0 3 4 682 0 3 4 683 0 3 4 684 0 3 4 685 0 3 4 686 0 3 4 687 0 3 4 688 0 3 4 689 0 3 4 690 0 3 4 691 0 3 4 692 0 3 4 693 0 3 4 694 0 3 4 695 0 3 4 696 0 3 4 697 0 3 4 698 0 3 4 699 0 3 4 700 0 3 4 701 0 3 4 702 0 3 4 703 0 3 4 704 0 3 4 705 0 3 4 706 0 3 4 707 0 3 4 708 0 3 4 709 0 3 4 710 0 3 4 711 0 3 4 712 0 3 4 713 0 3 4 714 0 3 4 715 0 3 4 716 0 3 4 717 0 3 4 718 0 3 4 719 0 3 4 720 0 3 4 721 0 3 4 722 0 3 4 723 0 3 4 724 0 3 4 725 0 3 4 726 0 3 4 727 0 3 4 728 0 1 9 1457 0 1 9 1458 0 1 9 1459 0 1 9 1460 0 1 9 1461 0 1 9 1462 0 1 9 1463 0 1 9 1464 0 1 9 1465 0 1 9 1466 0 1 9 1467 0 1 9 1468 0 1 9 1469 0 1 9 1470 0 1 9 1471 0 1 9 1472 0 1 9 1473 0 1 9 1474 0 1 9 1475 0 1 9 1476 0 1 9 1477 0 1 9 1478 0 1 9 1479 0 1 9 1480 0 1 9 1481 0 1 9 1482 0 1 9 1483 0 1 9 1484 0 1 9 1485 0 1 9 1486 0 1 9 1487 0 1 9 1488 0 1 9 1489 0 1 9 1490 0 1 9 1491 0 1 9 1492 0 1 9 1493 0 1 9 1494 0 1 9 1495 0 1 9 1496 0 1 9 1497 0 1 9 1498 0 1 9 1499 0 1 9 1500 0 1 9 1501 0 1 9 1502 0 1 9 1503 0 1 9 1504 0 1 9 1505 0 1 9 1506 0 1 9 1507 0 1 9 1508 0 1 9 1509 0 1 9 1510 0 1 9 1511 0 1 9 1512 0 1 9 1513 0 1 9 1514 0 1 9 1515 0 1 9 1516 0 1 9 1517 0 1 9 1518 0 1 9 1519 0 1 9 1520 0 1 9 1521 0 1 9 1522 0 1 9 1523 0 1 9 1524 0 1 9 1525 0 1 9 1526 2 2 9 1527 2 2 9 1528 2 2 9 1529 2 2 9 1530 2 2 9 1531 2 2 9 1532 2 2 9 1533 2 2 9 1534 2 2 9 1535 2 2 9 1536 2 2 9 1537 2 2 9 1538 2 2 9 1539 2 2 9 1540 2 2 9 1541 2 2 9 1542 2 2 9 1543 2 2 9 1544 2 2 9 1545 2 2 9 1546 2 2 9 1547 2 2 9 1548 2 2 9 1549 2 2 9 1550 2 2 9 1551 2 2 9 1552 2 2 9 1553 2 2 9 1554 2 2 9 1555 2 2 9 1556 2 2 9 1557 2 2 9 1558 2 2 9 1559 2 2 9 1560 2 2 9 1561 2 2 9 1562 2 2 9 1563 2 2 9 1564 2 2 9 1565 2 2 9 1566 2 2 9 1567 2 2 9 1568 0 3 9 1569 0 3 9 1570 0 3 9 1571 0 3 9 1572 0 3 9 1573 0 3 9 1574 0 3 9 1575 0 3 9 1576 0 3 9 1577 0 3 9 1578 0 3 9 1579 0 3 9 1580 0 3 9 1581 0 3 9 1582 0 3 9 1583 0 3 9 1584 0 3 9 1585 0 3 9 1586 0 3 9 1587 0 3 9 1588 0 3 9 1589 0 3 9 1590 0 3 9 1591 0 3 9 1592 0 3 9 1593 0 3 9 1594 0 3 9 1595 0 3 9 1596 0 3 9 1597 0 3 9 1598 0 3 9 1599 0 3 9 1600 0 3 9 1601 0 3 9 1602 0 3 9 1603 0 3 9 1604 0 3 9 1605 0 3 9 1606 0 3 9 1607 0 3 9 1608 0 3 9 1609 0 3 9 1610 0 3 9 1611 0 3 9 1612 0 3 9 1613 0 3 9 1614 0 3 9 1615 0 3 9 1616 0 3 9 1617 0 3 9 1618 0 3 9 1619 0 3 9 1620 0 3 9 1621 0 3 9 1622 0 3 9 1623 0 3 9 1624 0 3 9 1625 0 3 9 1626 0 3 9 1627 0 3 9 1628 0 3 9 1629 0 3 9 1630 0 3 9 1631 0 3 9 1632 0 3 9 1633 0 3 9 1634 0 3 9 1635 0 3 9 1636 0 3 9 1637 0 3 9 1638 0 1 3 365 0 1 3 366 0 1 3 367 0 1 3 368 0 1 3 369 0 1 3 370 0 1 3 371 0 1 3 372 0 1 3 373 0 1 3 374 0 1 3 375 0 1 3 376 0 1 3 377 0 1 3 378 0 1 3 379 0 1 3 380 0 1 3 381 0 1 3 382 0 1 3 383 0 1 3 384 0 1 3 385 0 1 3 386 0 1 3 387 0 1 3 388 0 1 3 389 0 1 3 390 0 1 3 391 0 1 3 392 0 1 3 393 0 1 3 394 0 1 3 395 0 1 3 396 0 1 3 397 0 1 3 398 0 1 3 399 0 1 3 400 0 1 3 401 0 1 3 402 0 1 3 403 0 1 3 404 0 1 3 405 0 1 3 406 0 1 3 407 0 1 3 408 0 1 3 409 0 1 3 410 0 1 3 411 0 1 3 412 0 1 3 413 0 1 3 414 0 1 3 415 0 1 3 416 0 1 3 417 0 1 3 418 0 1 3 419 0 1 3 420 0 1 3 421 0 1 3 422 0 1 3 423 0 1 3 424 0 1 3 425 0 1 3 426 0 1 3 427 0 1 3 428 0 1 3 429 0 1 3 430 0 1 3 431 0 1 3 432 0 1 3 433 0 1 3 434 1 2 3 435 1 2 3 436 1 2 3 437 1 2 3 438 1 2 3 439 1 2 3 440 1 2 3 441 1 2 3 442 1 2 3 443 1 2 3 444 1 2 3 445 1 2 3 446 1 2 3 447 1 2 3 448 1 2 3 449 1 2 3 450 1 2 3 451 1 2 3 452 1 2 3 453 1 2 3 454 1 2 3 455 1 2 3 456 1 2 3 457 1 2 3 458 1 2 3 459 1 2 3 460 1 2 3 461 1 2 3 462 1 2 3 463 1 2 3 464 1 2 3 465 1 2 3 466 1 2 3 467 1 2 3 468 1 2 3 469 1 2 3 470 1 2 3 471 1 2 3 472 1 2 3 473 1 2 3 474 1 2 3 475 1 2 3 476 0 3 3 477 0 3 3 478 0 3 3 479 0 3 3 480 0 3 3 481 0 3 3 482 0 3 3 483 0 3 3 484 0 3 3 485 0 3 3 486 0 3 3 487 0 3 3 488 0 3 3 489 0 3 3 490 0 3 3 491 0 3 3 492 0 3 3 493 0 3 3 494 0 3 3 495 0 3 3 496 0 3 3 497 0 3 3 498 0 3 3 499 0 3 3 500 0 3 3 501 0 3 3 502 0 3 3 503 0 3 3 504 0 3 3 505 0 3 3 506 0 3 3 507 0 3 3 508 0 3 3 509 0 3 3 510 0 3 3 511 0 3 3 512 0 3 3 513 0 3 3 514 0 3 3 515 0 3 3 516 0 3 3 517 0 3 3 518 0 3 3 519 0 3 3 520 0 3 3 521 0 3 3 522 0 3 3 523 0 3 3 524 0 3 3 525 0 3 3 526 0 3 3 527 0 3 3 528 0 3 3 529 0 3 3 530 0 3 3 531 0 3 3 532 0 3 3 533 0 3 3 534 0 3 3 535 0 3 3 536 0 3 3 537 0 3 3 538 0 3 3 539 0 3 3 540 0 3 3 541 0 3 3 542 0 3 3 543 0 3 3 544 0 3 3 545 0 3 3 546 0 1 2 183 0 1 2 184 0 1 2 185 0 1 2 186 0 1 2 187 0 1 2 188 0 1 2 189 0 1 2 190 0 1 2 191 0 1 2 192 0 1 2 193 0 1 2 194 0 1 2 195 0 1 2 196 0 1 2 197 0 1 2 198 0 1 2 199 0 1 2 200 0 1 2 201 0 1 2 202 0 1 2 203 0 1 2 204 0 1 2 205 0 1 2 206 0 1 2 207 0 1 2 208 0 1 2 209 0 1 2 210 0 1 2 211 0 1 2 212 0 1 2 213 0 1 2 214 0 1 2 215 0 1 2 216 0 1 2 217 0 1 2 218 0 1 2 219 0 1 2 220 0 1 2 221 0 1 2 222 0 1 2 223 0 1 2 224 0 1 2 225 0 1 2 226 0 1 2 227 0 1 2 228 0 1 2 229 0 1 2 230 0 1 2 231 0 1 2 232 0 1 2 233 0 1 2 234 0 1 2 235 0 1 2 236 0 1 2 237 0 1 2 238 0 1 2 239 0 1 2 240 0 1 2 241 0 1 2 242 0 1 2 243 0 1 2 244 0 1 2 245 0 1 2 246 0 1 2 247 0 1 2 248 0 1 2 249 0 1 2 250 0 1 2 251 0 1 2 252 1 2 2 253 1 2 2 254 1 2 2 255 1 2 2 256 1 2 2 257 1 2 2 258 1 2 2 259 1 2 2 260 1 2 2 261 1 2 2 262 1 2 2 263 1 2 2 264 1 2 2 265 1 2 2 266 1 2 2 267 1 2 2 268 1 2 2 269 1 2 2 270 1 2 2 271 1 2 2 272 1 2 2 273 1 2 2 274 1 2 2 275 1 2 2 276 1 2 2 277 1 2 2 278 1 2 2 279 1 2 2 280 1 2 2 281 1 2 2 282 1 2 2 283 1 2 2 284 1 2 2 285 1 2 2 286 1 2 2 287 1 2 2 288 1 2 2 289 1 2 2 290 1 2 2 291 1 2 2 292 1 2 2 293 1 2 2 294 0 3 2 295 0 3 2 296 0 3 2 297 0 3 2 298 0 3 2 299 0 3 2 300 0 3 2 301 0 3 2 302 0 3 2 303 0 3 2 304 0 3 2 305 0 3 2 306 0 3 2 307 0 3 2 308 0 3 2 309 0 3 2 310 0 3 2 311 0 3 2 312 0 3 2 313 0 3 2 314 0 3 2 315 0 3 2 316 0 3 2 317 0 3 2 318 0 3 2 319 0 3 2 320 0 3 2 321 0 3 2 322 0 3 2 323 0 3 2 324 0 3 2 325 0 3 2 326 0 3 2 327 0 3 2 328 0 3 2 329 0 3 2 330 0 3 2 331 0 3 2 332 0 3 2 333 0 3 2 334 0 3 2 335 0 3 2 336 0 3 2 337 0 3 2 338 0 3 2 339 0 3 2 340 0 3 2 341 0 3 2 342 0 3 2 343 0 3 2 344 0 3 2 345 0 3 2 346 0 3 2 347 0 3 2 348 0 3 2 349 0 3 2 350 0 3 2 351 0 3 2 352 0 3 2 353 0 3 2 354 0 3 2 355 0 3 2 356 0 3 2 357 0 3 2 358 0 3 2 359 0 3 2 360 0 3 2 361 0 3 2 362 0 3 2 363 0 3 2 364 0 1 1 1 0 1 1 2 0 1 1 3 0 1 1 4 0 1 1 5 0 1 1 6 0 1 1 7 0 1 1 8 0 1 1 9 0 1 1 10 0 1 1 11 0 1 1 12 0 1 1 13 0 1 1 14 0 1 1 15 0 1 1 16 0 1 1 17 0 1 1 18 0 1 1 19 0 1 1 20 0 1 1 21 0 1 1 22 0 1 1 23 0 1 1 24 0 1 1 25 0 1 1 26 0 1 1 27 0 1 1 28 0 1 1 29 0 1 1 30 0 1 1 31 0 1 1 32 0 1 1 33 0 1 1 34 0 1 1 35 0 1 1 36 0 1 1 37 0 1 1 38 0 1 1 39 0 1 1 40 0 1 1 41 0 1 1 42 0 1 1 43 0 1 1 44 0 1 1 45 0 1 1 46 0 1 1 47 0 1 1 48 0 1 1 49 0 1 1 50 0 1 1 51 0 1 1 52 0 1 1 53 0 1 1 54 0 1 1 55 0 1 1 56 0 1 1 57 0 1 1 58 0 1 1 59 0 1 1 60 0 1 1 61 0 1 1 62 0 1 1 63 0 1 1 64 0 1 1 65 0 1 1 66 0 1 1 67 0 1 1 68 0 1 1 69 0 1 1 70 2 2 1 71 2 2 1 72 2 2 1 73 2 2 1 74 2 2 1 75 2 2 1 76 2 2 1 77 2 2 1 78 2 2 1 79 2 2 1 80 2 2 1 81 2 2 1 82 2 2 1 83 2 2 1 84 2 2 1 85 2 2 1 86 2 2 1 87 2 2 1 88 2 2 1 89 2 2 1 90 2 2 1 91 2 2 1 92 2 2 1 93 2 2 1 94 2 2 1 95 2 2 1 96 2 2 1 97 2 2 1 98 2 2 1 99 2 2 1 100 2 2 1 101 2 2 1 102 2 2 1 103 2 2 1 104 2 2 1 105 2 2 1 106 2 2 1 107 2 2 1 108 2 2 1 109 2 2 1 110 2 2 1 111 2 2 1 112 0 3 1 113 0 3 1 114 0 3 1 115 0 3 1 116 0 3 1 117 0 3 1 118 0 3 1 119 0 3 1 120 0 3 1 121 0 3 1 122 0 3 1 123 0 3 1 124 0 3 1 125 0 3 1 126 0 3 1 127 0 3 1 128 0 3 1 129 0 3 1 130 0 3 1 131 0 3 1 132 0 3 1 133 0 3 1 134 0 3 1 135 0 3 1 136 0 3 1 137 0 3 1 138 0 3 1 139 0 3 1 140 0 3 1 141 0 3 1 142 0 3 1 143 0 3 1 144 0 3 1 145 0 3 1 146 0 3 1 147 0 3 1 148 0 3 1 149 0 3 1 150 0 3 1 151 0 3 1 152 0 3 1 153 0 3 1 154 0 3 1 155 0 3 1 156 0 3 1 157 0 3 1 158 0 3 1 159 0 3 1 160 0 3 1 161 0 3 1 162 0 3 1 163 0 3 1 164 0 3 1 165 0 3 1 166 0 3 1 167 0 3 1 168 0 3 1 169 0 3 1 170 0 3 1 171 0 3 1 172 0 3 1 173 0 3 1 174 0 3 1 175 0 3 1 176 0 3 1 177 0 3 1 178 0 3 1 179 0 3 1 180 0 3 1 181 0 3 1 182 0 1 6 911 0 1 6 912 0 1 6 913 0 1 6 914 0 1 6 915 0 1 6 916 0 1 6 917 0 1 6 918 0 1 6 919 0 1 6 920 0 1 6 921 0 1 6 922 0 1 6 923 0 1 6 924 0 1 6 925 0 1 6 926 0 1 6 927 0 1 6 928 0 1 6 929 0 1 6 930 0 1 6 931 0 1 6 932 0 1 6 933 0 1 6 934 0 1 6 935 0 1 6 936 0 1 6 937 0 1 6 938 0 1 6 939 0 1 6 940 0 1 6 941 0 1 6 942 0 1 6 943 0 1 6 944 0 1 6 945 0 1 6 946 0 1 6 947 0 1 6 948 0 1 6 949 0 1 6 950 0 1 6 951 0 1 6 952 0 1 6 953 0 1 6 954 0 1 6 955 0 1 6 956 0 1 6 957 0 1 6 958 0 1 6 959 0 1 6 960 0 1 6 961 0 1 6 962 0 1 6 963 0 1 6 964 0 1 6 965 0 1 6 966 0 1 6 967 0 1 6 968 0 1 6 969 0 1 6 970 0 1 6 971 0 1 6 972 0 1 6 973 0 1 6 974 0 1 6 975 0 1 6 976 0 1 6 977 0 1 6 978 0 1 6 979 0 1 6 980 2 2 6 981 2 2 6 982 2 2 6 983 2 2 6 984 2 2 6 985 2 2 6 986 2 2 6 987 2 2 6 988 2 2 6 989 2 2 6 990 2 2 6 991 2 2 6 992 2 2 6 993 2 2 6 994 2 2 6 995 2 2 6 996 2 2 6 997 2 2 6 998 2 2 6 999 2 2 6 1000 2 2 6 1001 2 2 6 1002 2 2 6 1003 2 2 6 1004 2 2 6 1005 2 2 6 1006 2 2 6 1007 2 2 6 1008 2 2 6 1009 2 2 6 1010 2 2 6 1011 2 2 6 1012 2 2 6 1013 2 2 6 1014 2 2 6 1015 2 2 6 1016 2 2 6 1017 2 2 6 1018 2 2 6 1019 2 2 6 1020 2 2 6 1021 2 2 6 1022 0 3 6 1023 0 3 6 1024 0 3 6 1025 0 3 6 1026 0 3 6 1027 0 3 6 1028 0 3 6 1029 0 3 6 1030 0 3 6 1031 0 3 6 1032 0 3 6 1033 0 3 6 1034 0 3 6 1035 0 3 6 1036 0 3 6 1037 0 3 6 1038 0 3 6 1039 0 3 6 1040 0 3 6 1041 0 3 6 1042 0 3 6 1043 0 3 6 1044 0 3 6 1045 0 3 6 1046 0 3 6 1047 0 3 6 1048 0 3 6 1049 0 3 6 1050 0 3 6 1051 0 3 6 1052 0 3 6 1053 0 3 6 1054 0 3 6 1055 0 3 6 1056 0 3 6 1057 0 3 6 1058 0 3 6 1059 0 3 6 1060 0 3 6 1061 0 3 6 1062 0 3 6 1063 0 3 6 1064 0 3 6 1065 0 3 6 1066 0 3 6 1067 0 3 6 1068 0 3 6 1069 0 3 6 1070 0 3 6 1071 0 3 6 1072 0 3 6 1073 0 3 6 1074 0 3 6 1075 0 3 6 1076 0 3 6 1077 0 3 6 1078 0 3 6 1079 0 3 6 1080 0 3 6 1081 0 3 6 1082 0 3 6 1083 0 3 6 1084 0 3 6 1085 0 3 6 1086 0 3 6 1087 0 3 6 1088 0 3 6 1089 0 3 6 1090 0 3 6 1091 0 3 6 1092 0 1 10 1639 0 1 10 1640 0 1 10 1641 0 1 10 1642 0 1 10 1643 0 1 10 1644 0 1 10 1645 0 1 10 1646 0 1 10 1647 0 1 10 1648 0 1 10 1649 0 1 10 1650 0 1 10 1651 0 1 10 1652 0 1 10 1653 0 1 10 1654 0 1 10 1655 0 1 10 1656 0 1 10 1657 0 1 10 1658 0 1 10 1659 0 1 10 1660 0 1 10 1661 0 1 10 1662 0 1 10 1663 0 1 10 1664 0 1 10 1665 0 1 10 1666 0 1 10 1667 0 1 10 1668 0 1 10 1669 0 1 10 1670 0 1 10 1671 0 1 10 1672 0 1 10 1673 0 1 10 1674 0 1 10 1675 0 1 10 1676 0 1 10 1677 0 1 10 1678 0 1 10 1679 0 1 10 1680 0 1 10 1681 0 1 10 1682 0 1 10 1683 0 1 10 1684 0 1 10 1685 0 1 10 1686 0 1 10 1687 0 1 10 1688 0 1 10 1689 0 1 10 1690 0 1 10 1691 0 1 10 1692 0 1 10 1693 0 1 10 1694 0 1 10 1695 0 1 10 1696 0 1 10 1697 0 1 10 1698 0 1 10 1699 0 1 10 1700 0 1 10 1701 0 1 10 1702 0 1 10 1703 0 1 10 1704 0 1 10 1705 0 1 10 1706 0 1 10 1707 0 1 10 1708 1 2 10 1709 1 2 10 1710 1 2 10 1711 1 2 10 1712 1 2 10 1713 1 2 10 1714 1 2 10 1715 1 2 10 1716 1 2 10 1717 1 2 10 1718 1 2 10 1719 1 2 10 1720 1 2 10 1721 1 2 10 1722 1 2 10 1723 1 2 10 1724 1 2 10 1725 1 2 10 1726 1 2 10 1727 1 2 10 1728 1 2 10 1729 1 2 10 1730 1 2 10 1731 1 2 10 1732 1 2 10 1733 1 2 10 1734 1 2 10 1735 1 2 10 1736 1 2 10 1737 1 2 10 1738 1 2 10 1739 1 2 10 1740 1 2 10 1741 1 2 10 1742 1 2 10 1743 1 2 10 1744 1 2 10 1745 1 2 10 1746 1 2 10 1747 1 2 10 1748 1 2 10 1749 1 2 10 1750 0 3 10 1751 0 3 10 1752 0 3 10 1753 0 3 10 1754 0 3 10 1755 0 3 10 1756 0 3 10 1757 0 3 10 1758 0 3 10 1759 0 3 10 1760 0 3 10 1761 0 3 10 1762 0 3 10 1763 0 3 10 1764 0 3 10 1765 0 3 10 1766 0 3 10 1767 0 3 10 1768 0 3 10 1769 0 3 10 1770 0 3...
  2 Comments
EK
EK on 8 Oct 2023
Edited: EK on 8 Oct 2023
thank you so much! You are awesome!

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 7 Oct 2023
sortrows specifying column 3 to sort on. The resulting matrix will group together all of the entries with the same trial-ID
  5 Comments
EK
EK on 8 Oct 2023
column 3 logs Trials Ids. Trial 1==1, Trial 2==2, etc. I need to shaffle the trials.
Dyuman Joshi
Dyuman Joshi on 8 Oct 2023
@EK, Bruno's question was that in what way randomizing column 3 matters? What is the idea/logic behind randomizing?

Sign in to comment.

Categories

Find more on Entering Commands in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!