How can I change pairs?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have pairs of A{i}=[ai bi]. How can I change them to pairs B{i}=[bi ai]. I like to use Matlab special features in matrices.
0 Commenti
Risposta accettata
Jos (10584)
il 23 Gen 2014
% the data
A = {[1 2], [3 4] , [5 6]}
% the insight
help fliplr
help cellfun
% the engine
B = cellfun(@fliplr, A, 'un', 0)
0 Commenti
Più risposte (1)
Walter Roberson
il 23 Gen 2014
B = mat2cell( fliplr(cell2mat(A)), ones(length(A)), length(A{1});
1 Commento
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!