Question

The following code must be written in matlab How to convert a 4d unit8 matrix of...

The following code must be written in matlab

How to convert a 4d unit8 matrix of size

28 28 1 50000

in Matlab to a matrix of size 784*5000

Give an example that clearly solves this issue. Thanks

Homework Answers

Answer #1

The problem here is either the first matrix has to be 28*28*1*5000 or the second matrix has to be 784*5000*10 because without these changes the sizes of the matrices are different.

So, I used two matrices to demonstrate the 2 cases.

a1 is of shape 28*28*1*5000

b1 is of shape 784*5000

a2 is of shape 28*28*1*50000

b2 is of shape 784*5000*10

CODE :

clear all; close all; clc;

a1 = ones(28,28,1,5000,'uint8');
b1 = reshape(a1,784,5000);

a2 = ones(28,28,1,50000,'uint8');
b2 = reshape(a2,784,5000,10);

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The following code must be written in Matlab I want to print the following in Matlab...
The following code must be written in Matlab I want to print the following in Matlab (x1,x2, x3, ....xn) = (0.33333, 0.33333, 0.33333,....) That is for n variables . The whole thing should be on the same line. I need to use fprintf and write out the coordinates with 5 decimal places of variable xn = (0.33333, 0.33333, 0.33333,....) Thanks!
The following code must be written in matlab. I have a list of inidices say L...
The following code must be written in matlab. I have a list of inidices say L = [1,2,5,10,6,7,] I want to loop through indices in a for loop from i=1:n , n=100 but I must skip all indices that are not in the list L How can I do this if I am not allowed to use the ismember function. Thankse
MATLAB PROGRAM: (Conditional if and switch).  You must prepare the code (instructions) in Matlab for the following...
MATLAB PROGRAM: (Conditional if and switch).  You must prepare the code (instructions) in Matlab for the following problem. A person weighs 72 kg and wants to know how many calories he spends during the time he performs the same activity. The activities that you are allowed to do are just sleeping or sitting at rest. The data he has are: a) while sleeping he consumes 1.06 calories per minute and b) while sitting at rest he consumes 1.68 calories per minute....
This is a written assignment that you must conduct exploratory research on how the government internalizes...
This is a written assignment that you must conduct exploratory research on how the government internalizes negative externality (you only need one market or one product or one activity). Recall negative externalities occur in many markets; for example, oil production, manufacturing, transportation, and smoking, etc. Please make sure that: 1. You clearly identify the market (product or activity) that causes negative externalities, which means the negative externalities must be also well defined. These could be shown with good statistics and...
Q3) The following matrix shows strategies and payoffs for two firms that must decide how to...
Q3) The following matrix shows strategies and payoffs for two firms that must decide how to price. (5 Points) Firm 1 Firm 2 Price High Price Low Price High 500, 500 -100, 400 Price Low 400, -100 250, 250 What is the Nash Equilibrium of this game? Q4) Use the marginal of product of labor to illustrate graphically the impact of an increase in immigration on employment and wages. (10 Points)
would someone kindly convert the following C code to java? thanks so much # include <stdio.h>...
would someone kindly convert the following C code to java? thanks so much # include <stdio.h> int main(void) { int changeOwed; int check; char invisibleChar; int count = 0; int numQ=0, numD=0, numN=0, numP=0; do{ printf("How much change is owed (in cents)?\n"); check = scanf("%d", &changeOwed); // returns 1 if the input is a number and returns 0 otherwise //Get's rid of any extra invisible characters if the input is a char/String do{ scanf("%c",&invisibleChar); }while(invisibleChar != '\n'); }while(check == 0...
1. Read the following instructions on 'How to Repair an Electric Fan' which are written in...
1. Read the following instructions on 'How to Repair an Electric Fan' which are written in three different parts before answering the question given. The instructions below are considered ineffective as they are not following the effective instructions strategy. 1 Turn your fan on to make sure that the motor works. Plug your fan in and turn it on to the highest power setting. If the fan blades move a little or it starts to turn, the motor is probably...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b,...
Problem Definition: Problem: Given an array of integers find all pairs of integers, a and b, where a – b is equal to a given number. For example, consider the following array and suppose we want to find all pairs of integers a and b where a – b = 3 A = [10, 4, 6, 16, 1, 6, 12, 13] Then your method should return the following pairs: 4, 1 15, 12 13, 10 A poor solution: There are...
NWS620S Tutorial 1: Symmetric Encryption - DES Encryption is the translation of data into a secret...
NWS620S Tutorial 1: Symmetric Encryption - DES Encryption is the translation of data into a secret code so that only authorised entities can read it. Encrypting data is considered a very effective way of achieving data security. To access encrypted data, you must have access to a secret key that enables you to decrypt it. Unencrypted data is called plain text; encrypted data is referred to as cipher text. There are two types of encryption: • Symmetric encryption • Asymmetric...
What are 4 key things you learned about the topic from reading their paper? How does...
What are 4 key things you learned about the topic from reading their paper? How does the topic relate to you and your current or past job? Critique the paper in terms of the organization and quality. Team 3 answer questions above. Part I In today’s world we see fear among people when dealing with sexual harassment. This leads to people not reporting sexual harassment. A misconception about sexual harassment is that it’s only about touching and forcing other people...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT