photo

BobH


Last seen: 8 mois il y a Actif depuis 2020

Followers: 0   Following: 0

Message

Statistiques

  • Knowledgeable Level 3
  • 3 Month Streak
  • Knowledgeable Level 2
  • First Answer

Afficher les badges

Feeds

Afficher par

Réponse apportée
getting the information from the figure
For recent versions of MATLAB (R2019a and after), the help on writematrix has useful examples that I think apply to your questio...

environ 4 ans il y a | 0

Réponse apportée
I am trying to put zero on top of each generated column.
Your first reshape is the right approach, to arrange the values into a matrix with the right number of columns ws = 6; ...

environ 4 ans il y a | 0

| A accepté

Réponse apportée
Validating each value using a while loop
I think your while loop needs to have the input() within it While the user hasn't given a valid number Ask for a number ...

environ 4 ans il y a | 0

Réponse apportée
How can I get my minimum spanning tree to select only one edge?
If this calculation is a smaller part of a larger problem like determining the shortest path between a pair of distant nodes, th...

environ 4 ans il y a | 0

Réponse apportée
getting the information from the figure
This older question/answer suggests adding the 'Tag' property to the plot. https://www.mathworks.com/matlabcentral/answers/1166...

environ 4 ans il y a | 0

| A accepté

Réponse apportée
How to match two arrays in Matlab
Is this what you are trying to get? Second column of B based on C matching A A = 1:10; B = [21 22;10 11;23 25;33 30;32 35;21 ...

plus de 4 ans il y a | 0

Réponse apportée
How to quickly find the column index of the last non-zero element in all rows in a sparse matrix?
reorderRow = arrayfun(@(X) find(A(X,:),1,'last'), 1:size(A,1)) reorderRow = 1 2 3 2 3

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
Help with extracting info from a listbox in a specific way
You can build a cell array using the row as the index, and each element of the cell array can be a numeric array of the column(s...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Replace string and then place it again
This is intentionally backwards from what you asked; adjusting it to start with all '#' is for you helpful: https://www.mathwor...

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
Reordering string arrays if string is >9
sort_nat is powerful, and has helped me several times. An alternative for simple number/not-number values is straightforward f...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How to sum matrix of different size on Simulink? (R2019a)
The dimensions must agree, in MATLAB. Z = zeros(400,32); O = ones(1,32); Z+O; Error using + Matrix dimensions must agree....

plus de 4 ans il y a | 1

Réponse apportée
Using 'for loop' on a function call
If you want to iterate along x_min and x_max, you can use a single counter in your for loop for i = 1 : length(x_min) % both v...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Concatenating vectors based on list of variable names
c = cellfun(@eval, order, 'un', 0); r = vertcat( c{:} ); % horzcat if that's what you wanted, and all variables in order are...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How do I delete cell elements from a cell array?
function kmvsolve hw_i = {'K',5,2; 50,4,'v'; 70,'m',9 }; hw_o = physicsHW( hw_i ) end function out = physi...

plus de 4 ans il y a | 0

Réponse apportée
Why is my code messing up on this specific test case?
function out = lostAtSeaCucumber( vec, srch ) collected = ''; % temporary storage for names visited = zeros(size(ve...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How can I index a vector based on the vector's values?
V = [2 5 4 1 3]; R(1) = V(1); for i = 2:length(V) R(end+1) = V( R(i-1) ); end R % new vector R = 2 5 3 ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Change Julian date read in from excel to a MM-dd-yyyy form and plotting
see https://www.mathworks.com/help/exlink/convert-dates-between-microsoft-excel-and-matlab.html and perhaps this old question w...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Importing txt files and using loops
Similar to Mario Malic but using regular expressions R = []; % init to empty fid = fopen('J94.txt','r'); t = fge...

plus de 4 ans il y a | 0

Réponse apportée
Shifting of 3D curve
You seem to be dividing the axis scale by 5. The same steps also apply to 'XTickLabel' ylabel = get(gca, 'YTickLabel') % ret...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Reduce MATLAB method startup time
I couldn't find a way to avoid the delay, but I use this to give the user a reason for the delay. It uses my specific situatio...

plus de 4 ans il y a | 0

Réponse apportée
for loop for switch case
would arrayfun work for your code? It would handle both x as a single number and x as a vector, setting 'a' to a single number ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Updating a zeroized matrix with provided row vectors
Force(Nodal_Loads(:,1),:) = Nodal_Loads(:,2:4)

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
how can i deal with .mat file in Matlab?
See load It will add variables from the mat file to your workspace.

plus de 4 ans il y a | 0

Réponse apportée
Find and replace in a character array
See regexprep and remember that to get a single-quote it must be doubled up in the replacement string F='(B~C) + (~AB)'; rege...

plus de 4 ans il y a | 0

Réponse apportée
Storing the output of a program in a matrix
Do you mean like this? progA = @() 42; % return 42 for each invocation y = progA() y = 42 z = arrayfun(@(X) progA(),...

plus de 4 ans il y a | 0

Réponse apportée
Coordinates of a 3 by 3 by 3 array
yy=zeros(3,3,3); yy(1,2,3) = 1 yy(:,:,1) = 0 0 0 0 0 0 0 0 0 yy(:,:,2) = 0 ...

plus de 4 ans il y a | 0

Réponse apportée
How to shuffle matrix entries using MATLAB?
perhaps a modification based on the sample code showing use of perms?

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
Extract lines of a three dimensional matrix using an array of indices and NO for-loop
Use column 1 of m to select rows of r in the first >> r( m(:,1), :,1) ans = 1 0 2 1 1 Use column 2 of m...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
How do I create a matrix from a file from reading the first row and then use that first number to control a "for" loop to build
MOHD AQUIB is on the right track, reading one data point first before the loop, but left out the part within the loop that conti...

plus de 4 ans il y a | 0

Réponse apportée
How can turn two indexing vectors into a corresponding matrix that counts how many locations that point has been hit?
The diagonal of a matrix is those elements whose subscripts are (1,1), (2,2), etc s = sparse(x, y, 1) s = (1,1) 2 ...

plus de 4 ans il y a | 0

| A accepté

Charger plus