MATLAB: Calling variables instead of values matrix manipulation I have this: A=1; B=2; C=3;x = [2 3 1] I want to call x1 as: x1 = B C A I can call individual values, but I don't know how to call them as variables. Best Answer xc = num2cell(x)[B C A]= xc{:}ADDx = [2 3 1]xc = {'A' 'B' 'C'}x1 = xc(x) Related SolutionsMATLAB: All the combinations of sums of rows of matrices Code for arbitrary number of matrixA=[... 1 0 2 1 2 4 1 3 0 1 3 2];B=[... 1 3 0 5];C=[... 2 1 3 0 1 4 0 3];% Start from hereCA = {A,B,C}; % add more matrices if neededCA = CA(:);s1 = cellfun('size',CA,1);c = arrayfun(@(n) 1:n, s1, 'unif', 0);[c{:}] = ndgrid(c{:});n = length(CA);c = reshape(cat(n+1,c{:}),[],n)';c = c + cumsum([0;s1(1:n-1)]);AA = cell2mat(CA);R = reshape(AA(c,:),n,[],size(A,2));R = reshape(sum(R,1),[],size(A,2)) MATLAB: Write a matlab command to find th roots of: ax^2+bx+c=0 a=1;b=2;c=3;x1 = -b +(sqrt((b^2)-(4ac)/(2a))x;x2=-b-(sqrt((b^2)-(4ac)/(2a));disp(x1);disp(x2); Related QuestionQuestion about vectorization using indexesError when plotting functionCalling variables instead of valuesI have 2 cellArray which changes double to string. I wanna compare these 2 cellArray whether they are same or not.Delete matrix in cellHow to vectorize this find functionHow to combine two cell arrays to corresponding elements
Best Answer