Réponse apportée
I'm trying to display pascals triangle but the higher numbers are messing up the formatting, any solutions?
You can specify some field widths in your fprintf calls. rows = 15; PT = zeros(rows); for c = 1:rows PT(c,1) = 1; f...

plus de 3 ans il y a | 1

Réponse apportée
Vectorize output of for loop, but using specific vector values
k=1.38E-23; E0= 2.72361635536024e-21 M=3; myVector = zeros(M+1,1); T = [100,300,1000,3000]; for ii = 1:numel(T) ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
comparision of data with logic given as input
Assuming T1, ..., T10 are scalars, T = [T1 T2 T3 T4 T5 T6 T7 T8 T9 T10]; [~,idx] = max(T); I = zeros(size(T)); I(idx) = ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to label the x axis in matlab for boxplot ?
xticklabels({'january','feb','mar'})

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
combine cell data into column
M = vertcat(C{:}); where C is your cell array; M will be your big column vector.

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Changing numeric matrix name with the loaded file
[fn,pn] = uigetfile('*.mat','Select .mat File'); if isequal(fn,0) return % user closed dialog without selecting a file ...

plus de 3 ans il y a | 0

Réponse apportée
plot a graph from user input
Change this: plot(u,t) to this: plot(t,u)

plus de 3 ans il y a | 0

Réponse apportée
ASCII/HAMMING DECODER
It's been awhile since I studied error-correcting codes, but I believe that with this generator matrix: G = [1 0 0 0 1 1 0; ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to plot histogram using given data ?
% Value first Second third M = [ ... 10 0.67 0.66 0.70; ... 20 0.38 0.37 0.42; ... 30 0.26 0.25 0...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to change a range of numbers in a matrix to a random number of a matrix?
G = reshape(1:125,[25,5]) x = setdiff(0:24, 2:25) idx = G >= 2 & G <= 25; G(idx) = x(randi(numel(x),[nnz(idx),1]))

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Parsing this line 'Step Information: Rload=100 R1=1 (Run: 2/18)'
Here's one way: % Example line to parse line = 'Step Information: Rload=100 R1=1 (Run: 2/18)'; % Parse the line using rege...

plus de 3 ans il y a | 0

Réponse apportée
Appdesigner get Index and String from DropDownMenu
If you need the index and the string, then the way you're doing it is good. If you just need the string, you should do away wit...

plus de 3 ans il y a | 0

Réponse apportée
How to plot a trajectory with varying colour?
"I'm trying to assign an independent variable to a data point in 2D through colour." You can choose any colour(s) you like. Ex...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Develop a reordering matrix based on stored vectors
order_old = [1 2 3 4 5 6]; order_new = [4 5 1 2 3 6]; Output = order_old.' == order_new

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Retrieve App Designer textarea content along with the newline characters
The multi-line text is stored as a cell array of character vectors in the textarea's Value, so to present it with newlines, you ...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Extracting Corresponding values from an array
Example usage, function defined below. matrix = [1 2; 3 4; 5 6; 1 8] get_2nd_column_val(matrix,3) get_2nd_column_val(matrix,1...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Create function to convert data type as table: 2 errors
One problem appears to be that the function expects a table but you're giving it a categorical array. I can't say for sure becau...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
How to iterate through the struct char to label a new struct correctly?
for x = 1 : length(theFiles) baseFileName = theFiles(x).name; %e.g. for x =1 , baseFileName = 'sample_1.mat' [~,fn,~] ...

plus de 3 ans il y a | 0

Réponse apportée
Polyfit function is returning a partial line of best fit
Rather than calling plot with the fitobject returned from fit, you can use coeffvalues to get the coefficients of the fitobject ...

plus de 3 ans il y a | 1

Réponse apportée
ASCII TO HAMMING CODE 7.4
I would check that you're putting the elements of encodedMsg in the right order here: encodedMsgStr = num2str(encodedMsg(:).');...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How do I create a loop to give me cut-off value
cutoff = 1500; vals = [200,450,950,1000,1200,1450,1550,1600,1650]; for ii = 1:numel(vals) if vals(ii) >= cutoff ...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
made up function not running in matlab, error: unrecognized function or variable. How can I get this fixed?
Looks like the first three lines: image1 = imread('ex.tif'); [avg_profile, radius] = radialProfile(image1, 12); plot(radius, ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
how extract table RowNames based on table elements
% a table as you describe t = table([1;NaN;3;4;NaN],'RowNames',{'A';'B';'C';'D';'E'}) % extract RowNames of the NaN rows nan_...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
How to extract column index based on value in another column?
% first I create a table of random data n_rows = 15; data = zeros(n_rows,4); for ii = 1:n_rows data(ii,:) = randperm(4);...

plus de 3 ans il y a | 0

Réponse apportée
How to assign 0 or 1 randomly to the coordinates?
val = randi([0 1], size(X)) ;

plus de 3 ans il y a | 0

Réponse apportée
Load multiple files on MATLAB
n_files = 10; VACF_all = zeros(n_files,100); % Pre-allocate a matrix to store all the VACF results. ...

plus de 3 ans il y a | 0

| A accepté

Réponse apportée
Not able to combine data in cells of different sizes
Here's one way. The idea is to use NaNs to fill out the matrix you build. n_files = 30; n_c = 0; c = NaN(n_c, n_files); fo...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
Looping through sets of names for a match and selecting variable with this name
You're comparing a numeric index (xx), which is between 1 and length(accvectors_name), with a length-3 character vector (ID). In...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
How to eliminate a number of rows at certain points of a large data set?
If rawdata is your matrix: % number of rows in your matrix: N_rows = size(rawdata,1); % construct a logical vector of 500 t...

plus de 3 ans il y a | 1

| A accepté

Réponse apportée
How can I plot contour lines on the generated map?
In your code, you make the map then create a new figure for each contour. Those new figures aren't going to have the map; the ma...

plus de 3 ans il y a | 0

| A accepté

Charger plus