Suppose I have created the matrix C=[1 2 3; 3 4 5;6 7 8;9 10 11;12 13 14;15 16 17];
and I would like to pick up any row vector randomly from this C matrix.
Which MATLAB command/function useful for this?
Perhaps you may try to obtain the random row from your matrix with this code:
C = [1 2 3; 3 4 5; 6 7 8; 9 10 11; 12 13 14; 15 16 17];
N1 = 1;
N2 = 6;
r = randperm(N2, N1);
randomMatrixRow = C(r, :);
Hi, if I understand well, you need an integer random number generator.
You can use the 'randi' MATLAB function to generate random integers between 1 and the number of lines of your matrix. Best
Dear Anita Zade,
Also you can use function called randsample in Statistics Toolbox or like sayed Prof Richard Epenoy use "randi" in Matlab.
Best regards
Here is another piece of code (according to colleague Richard Epenoy):
sz = size(C);
r = randi(sz(1));
randomMatrixRow = C(r, :)
You can usa the randperm function
Row = C(randi(length(C),1,1),:)
To Kiarash Aryankia: it is such a neat piece of code!
Very grateful to see all the optional answers.
For me randsample function worked perfectly.
c=[1 2 3; 3 4 5;6 7 8;9 10 11;12 13 14;15 16 17 ];
[m,n] = size(c )
idx = randsample(m,1 )
iwant = c(idx,:)
poultry production in nigeria
29 July 2024 5,518 2 View
What techniques or assays will be used when a purified lyophilized powder is purchased from a company to study protein-protein interaction?
15 July 2024 1,598 3 View
Trouble 1: I ran a PCR reaction and found a low molecular weight band (100 bp) when doing electrophoresis. 1ng plasmid (OD260/280=1.84) was used as template. Final concentration of primers was...
13 June 2024 5,540 6 View
Good morning, I am currently engaged in research in the field of virtual reality. I would be grateful if you could share your opinion on the subject. Your input is invaluable to me. Kind...
25 May 2024 8,567 5 View
I want to detect my target protein through WB and it worked well before. But now I could not get any signal for both my target and the GAPDH, so I ran SDS-PAGE. I expected many bands on the gel of...
23 May 2024 613 6 View
I want to copy a target gene from cDNA into a plasmid. The primers were designed according to the CDS sequence from NCBI. But when I performed PCR reactions I could not get any target bands. So...
15 April 2024 2,115 4 View
I found to use a wrong secondary Ab for my WB when I visualized it with ECL, can I wash with TBST for several times and incubate the right secondary Ab? Another question is why my bands are not...
16 February 2024 3,187 4 View
👋 Sto attualmente conducendo una ricerca finalizzata ad esplorare come le attività di employer branding possano permettere alle imprese di garantire una EVP (Employee Value Proposition) di...
17 January 2024 9,183 1 View
When I overexpressed a protein in a cell line, I found decrease of phospho-PLC (phospholipase C) at the protein level through WB. But when I knocked out the protein, there was no difference of...
10 January 2024 8,201 3 View
I want to use the Cre LoxP to knock out my target gene in a mammalian cell line. According to the mechanism, I need to add two loxP sequences at both ends of the gene through homologous...
21 November 2023 5,133 1 View
Approximate concentrations are require in compared with the WHO permissible limts
11 August 2024 2,723 1 View
I am developing a predictive model for a water supply network that involves 20 influencing points. However, I only have historical data for 10 out of these 20 points. I would like to know how to...
10 August 2024 4,005 2 View
How do interactions between the biosphere, the carbon cycle, and the water cycle impact global warming and interaction between the atmosphere and the hydrosphere?
09 August 2024 3,291 2 View
I need to model an anisotropic material in which the Poisson's ratio ν_12 ≠ ν_21 and so on. Therefore, the elastic compliance matrix wouldn't be a symmetric one. In ANSYS APDL, for TB,ANEL...
09 August 2024 5,048 2 View
One can try to generalize the Vandermonde determinant in the following direction: Let $A$ be any symmetric $n$-order square matrix. Consider its powers' diagonal elements $(A^k)_{ii}$ and...
08 August 2024 6,690 1 View
Have you ever seen a LC-MS/MS method uses both internal standards and external standards (in matrix matching purpose) but the concentrations of internal standards are outside the calibration curve...
05 August 2024 3,084 6 View
I have protein-membrane simulations (PDB, PSF, DCD) and have noticed that water molecules near the protein are not visible in the simulations. How can I fix this issue? Is there a way to place the...
04 August 2024 1,200 2 View
- The Existence/Uniqueness of Solutions to Higher Order Linear Differential Equations - Higher Order Homogenous Differential Equations - Wronskian Determinants of $n$ Functions - Wronskian...
03 August 2024 2,366 0 View
Dear Researchers I need to know, how to load and plot 2D-PIV (particle image velocimetry) recorded velocity vector field data in Tecplot? Thank You
02 August 2024 3,615 1 View
Why is nonpoint source pollution potentially more harmful and difference between point and nonpoint sources of water pollution?
01 August 2024 1,180 2 View