I have written code as below. a is input matrix. b (i) the vectors to be extracted.
clear all, clc;a=[1 2; 3 4; 5 6; 7 8]for i=1:4 b=a(i,:)end
I want to extract vectors as b1, b2, b3, b4. Also get the output in print as vectors extracted are b1, b2, b3, b4 (new line) from the matrix a. How can I code it appropriately?
When I try the command b(i)=a(i:1), I get error 'assignment dimension mismatch' When I try with extra command c(i)=b(i) with or without for loop, error displayed is 'index exceeds matrix dimensions'
Best Answer