MATLAB: Using a variable value as linear array index array indexingarrays Can you use a variable as an array index? for example: C = 200 – 30 then use C as the linear index for the array. B(C) This just multiplies B by C. Can you tell the program to just use the value of C? Best Answer YesB(C)will use C to index into B, it doesn't multiply at all.Surely you could just try this out on the command line, it is how I learned a lot of what I know! Related SolutionsMATLAB: Linear index to matrix index ii = 475000;m = size(A,1);r = rem(ii,m);c = ceil(ii/m); MATLAB: How to get values from an array using another logical array Instead ofA(B)tryA.*B Related QuestionIndexingUsing if condition store values in an arrayTable linear indexing errorIndexingHow to create a variable for subscripts of an array
Best Answer